Beginner question: mapping events to the RIC I subscribed to?
If I subscribe to "IBM.N" for example via:
UInt64 IBMhandle = pConsumer->registerClient( ReqMsg().serviceName( "ELEKTRON_DD" ).name( "IBM.N"), *this );
Is there no way to tie the event back to the RIC name other than the handle?
For example:
void AppClient::onRefreshMsg( const RefreshMsg& refreshMsg, const OmmConsumerEvent& event)
{
if(event.getHandle() == IBMhandle) { cout << "I have an update for IBM!!!" << endl ; }
if (DataType::FieldListEnum == refreshMsg.getPayload().getDataType())
decode(refreshMsg.getPayload().getFieldList());
}
Is there no way to get the RIC name directly from the event?
Best Answer
-
Hi @jtalvy
If you want the instrument name, have you looked at another consumer example e.g. Consumer120 - 120__MarketPrice__FieldListWalk?
Both the onRefresh() and onUpdate() dump the name of the item using the getName() method
void AppClient::onRefreshMsg( const RefreshMsg& refreshMsg, const OmmConsumerEvent& )
{
if ( refreshMsg.hasName() )
cout << endl << "Item Name: " << refreshMsg.getName();
.....
}
void AppClient::onUpdateMsg( const UpdateMsg& updateMsg, const OmmConsumerEvent& )
{
if ( updateMsg.hasName() )
cout << endl << "Item Name: " << updateMsg.getName();
....
}You can also consider using Closures - please see the post Example of closure in EMA
In the post above it uses simple descriptors for the closure, a more realistic usage could be to pass in your local application level object that represents the instrument as the closure and then get back a reference to the object in the callback event.
OR you could just pass in the RIC as the closure....
0
Answers
-
EMA library keeps a Map behind the scenes between Handles and data items names. Using this, it is able to inject the data item name into the messages so that is looks as if it was received from the wire (it is not!). So Umar's answer will work just fine. EMA is "developer convenient" in this respect. (as opposed to the underlying API, called ETA, where you have to take care of this yourself but also have more control)
0 -
I just implemented the code as Umer suggested and I get the RIC name in both the Refresh and Update.
Are you saying this is unreliable and I should still do a map with the handle?
BTW.... I connect to EZD to get the data.
0 -
@jtalvy. Apologies. I made assumptions based on what I know from ETA, not EMA. I've updated my answer. You are not increasing network traffic. (but there is in fact a feature where you can ask the server side to send the information with each and every UPDATE message and using that feature will increase network traffic, but what EMA does it actually to simulate that feature)
0
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
- 684 Datastream
- 1.4K DSS
- 615 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
- 251 ETA
- 555 WebSocket API
- 37 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
- 643 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
- 228 TRKD
- 916 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 中文论坛