How to encode msgKey attribute in RFA Java
Best Answer
-
@Catherine Wong
According to the document (<RFA_PACKAGE>/Docs/refman/rfajava/com/reuters/rfa/omm/OMMEncoder.html), if the application wants to encode attrib, it must not specify the second parameter as OMMTypes.NO_DATA.
encodeMsgInit
void encodeMsgInit(OMMMsg msg,
short attibDataType,
short dataType)
OMMMsg encoding initialization
Parameters:
msg - the message to be encoded.
attibDataType - the data type that is contained in the OMMAttribInfo. OMMTypes.NO_DATA if encoded OMMAttribInfo will not contain OMMData (i.e. OMMAttribInfo.getAttrib()).
dataType - the data type that is contained in the message. OMMTypes.NO_DATA if encoded message will not contain data.Referring to RFA Java RDM Usage guide, OMMAttribInfo.Attrib is not used in most of domains except a Login domain.
Since the RFA example applications usually manage the administrative domain (Login, Source Directory, and Dictionary) automatically, you can find the simple demonstration from a LoginClient.encodeLoginReqMsg() method of a StarterConsumer example.
Please see the snippet code below:
private OMMMsg encodeLoginReqMsg()
{
OMMEncoder encoder = _mainApp.getEncoder();
OMMPool pool = _mainApp.getPool();
encoder.initialize(OMMTypes.MSG, 500);
OMMMsg msg = pool.acquireMsg();
msg.setMsgType(OMMMsg.MsgType.REQUEST);
msg.setMsgModelType(RDMMsgTypes.LOGIN);
msg.setIndicationFlags(OMMMsg.Indication.REFRESH);
msg.setAttribInfo(null, CommandLine.variable("user"), RDMUser.NameType.USER_NAME);
encoder.encodeMsgInit(msg, OMMTypes.ELEMENT_LIST, OMMTypes.NO_DATA);
encoder.encodeElementListInit(OMMElementList.HAS_STANDARD_DATA, (short)0, (short)0);
encoder.encodeElementEntryInit(RDMUser.Attrib.ApplicationId, OMMTypes.ASCII_STRING);
encoder.encodeString(CommandLine.variable("application"), OMMTypes.ASCII_STRING);
encoder.encodeElementEntryInit(RDMUser.Attrib.Position, OMMTypes.ASCII_STRING);
encoder.encodeString(CommandLine.variable("position"), OMMTypes.ASCII_STRING);
encoder.encodeElementEntryInit(RDMUser.Attrib.Role, OMMTypes.UINT);
encoder.encodeUInt((long)RDMUser.Role.CONSUMER);
encoder.encodeAggregateComplete();
// Get the encoded message from the encoder
OMMMsg encMsg = (OMMMsg)encoder.getEncodedObject();
// Release the message that own by the application
pool.releaseMsg(msg);
return encMsg; // return the encoded message
}Below is an application log:
MESSAGE
Msg Type: MsgType.REQUEST
Msg Model Type: LOGIN
Indication Flags: REFRESH
Hint Flags: HAS_ATTRIB_INFO
AttribInfo
Name: U0154418
NameType: 1 (USER_NAME)
Attrib
ELEMENT_LIST
ELEMENT_ENTRY ApplicationId: 256
ELEMENT_ENTRY Position: 10.42.85.159/U0154418-TPL-A
ELEMENT_ENTRY Role: 0
Payload: NoneHope this helps!
0
Answers
-
In RFA Java 8 kit, please see framework => provider => DictionaryStreamItem:
...
OMMAttribInfo attribInfo = pool.acquireAttribInfo();
attribInfo.setServiceName(_dictMgr.getServiceName());
attribInfo.setName(_name);
attribInfo.setFilter(filter); // Specifies all of the normally needed
// data will be sent.
msg.setAttribInfo(attribInfo);
enc.encodeMsgInit(msg, OMMTypes.NO_DATA, OMMTypes.SERIES); // Data is
...0 -
@zoya.farbefov
Thanks, but if I just want to add ElementList in the msgKey too? How can I set it to OMMAttribInfo object. It provides setFilter(), setId(), setName(), setNameType(), setServiceID() and setServiceName() only.
0 -
I think you are looking to encode ElementList into message itself ( you are writing a provider) as OMMAttribInfo is designed to provide optional attributes/hints.
Please see in reference OMMEncoder for specifics on how to encode and complete on OMMData, OMMEelemntList is OMMData.
Please see example of Series encoding in provider => DictionaryStreamItem, it is the same approach.
0 -
It looks like what I want. I can attach some parameters in msg.Attrib along with the request message.
MESSAGE
Msg Type: MsgType.REQUEST
Msg Model Type: Unknown Msg Model Type: 254
Indication Flags: REFRESH
Hint Flags: HAS_ATTRIB_INFO | HAS_QOS_REQ
QosReq: (RT, TbT)
AttribInfo
ServiceId: 1
Name: CW_TEST_CUSTOM_RIC
NameType: 1
Attrib
ELEMENT_LIST
ELEMENT_ENTRY startDate: 01/01/2016
ELEMENT_ENTRY stopDate: 25/02/2016
ELEMENT_ENTRY threshold: 3
Payload: None0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 685 Datastream
- 1.4K DSS
- 616 Eikon COM
- 5.2K Eikon Data APIs
- 10 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 252 ETA
- 557 WebSocket API
- 38 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 275 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.9K Refinitiv Data Platform
- 654 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 193 TREP Infrastructure
- 229 TRKD
- 917 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 90 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛