Discover Refinitiv
MyRefinitiv Refinitiv Perspectives Careers
Created with Sketch.
All APIs Questions & Answers  Register |  Login
Ask a question
  • Questions
  • Tags
  • Badges
  • Unanswered
Search:
  • Home /
  • Elektron /
  • EMA /
avatar image
Question by jtalvy · Aug 10, 2017 at 11:57 AM · elektronrefinitiv-realtimeelektron-sdkrrtema-apielektron-message-apiricsevents

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?

People who like this

0 Show 0
Comment
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

2 Replies

  • Sort: 
avatar image
REFINITIV
Best Answer
Answer by umer.nalla · Aug 10, 2017 at 12:09 PM

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....

Comment
jtalvy

People who like this

1 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

avatar image
Answer by Lars-at-Addicticks · Aug 10, 2017 at 12:12 PM

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)


Comment
jtalvy

People who like this

1 Show 2 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

avatar image
jtalvy · Aug 10, 2017 at 12:20 PM 0
Share

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.

avatar image
Lars-at-Addicticks · Aug 10, 2017 at 12:58 PM 0
Share

@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)

Watch this question

Add to watch list
Add to your watch list to receive emailed updates for this question. Too many emails? Change your settings >
10 People are following this question.

Related Questions

EMA CPP - Exception adding ric into OmmArray

Has RIC 1RTYM1m been changed to RTYM1m

(JAVA) Does using interestAfterRefresh(false) remove the need for deregistering items with Elektron?

How do you identify if a RIC is a chain RIC in order to subscribe to all the underlying RICs?

How can I find Non-deliverable Forward RIC for BRL, CLP, COP, IDR, KRW, MYR, PEN, PHP, RUB, VND ?

  • Copyright
  • Cookie Policy
  • Privacy Statement
  • Terms of Use
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Alpha
  • App Studio
  • Block Chain
  • Bot Platform
  • Connected Risk APIs
  • DSS
  • Data Fusion
  • Data Model Discovery
  • Datastream
  • Eikon COM
  • Eikon Data APIs
  • Electronic Trading
    • Generic FIX
    • Local Bank Node API
    • Trading API
  • Elektron
    • EMA
    • ETA
    • WebSocket API
  • Intelligent Tagging
  • Legal One
  • Messenger Bot
  • Messenger Side by Side
  • ONESOURCE
    • Indirect Tax
  • Open Calais
  • Open PermID
    • Entity Search
  • Org ID
  • PAM
    • PAM - Logging
  • ProView
  • ProView Internal
  • Product Insight
  • Project Tracking
  • RDMS
  • Refinitiv Data Platform
    • Refinitiv Data Platform Libraries
  • Rose's Space
  • Screening
    • Qual-ID API
    • Screening Deployed
    • Screening Online
    • World-Check One
    • World-Check One Zero Footprint
  • Side by Side Integration API
  • TR Knowledge Graph
  • TREP APIs
    • CAT
    • DACS Station
    • Open DACS
    • RFA
    • UPA
  • TREP Infrastructure
  • TRKD
  • TRTH
  • Thomson One Smart
  • Transactions
    • REDI API
  • Velocity Analytics
  • Wealth Management Web Services
  • Workspace SDK
    • Element Framework
    • Grid
  • World-Check Data File
  • 中文论坛
  • Explore
  • Tags
  • Questions
  • Badges