question

Upvotes
Accepted
2 1 2 2

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?

elektronrefinitiv-realtimeelektron-sdkema-apirrtelektron-message-apiricsevents
icon clock
10 |1500

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

Thank you for your participation in the forum.
Is the reply below satisfactory in resolving your query? If yes please click the 'Accept' text next to the reply. This will guide all community members who have a similar question. Otherwise please post again offering further insight into your question.
Thanks,
-AHS

Hello again!

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?

If yes please click the 'Accept' text next to the reply. This will guide all community members who have a similar question. Otherwise please post again offering further insight into your question.

Thanks,

AHS

Upvote
Accepted
25.3k 87 12 25

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

icon clock
10 |1500

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

Upvote
1.5k 5 6 7

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)


icon clock
10 |1500

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

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.

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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