question

Upvotes
Accepted
2 0 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-sdkrrtema-apielektron-message-apiricsevents
icon clock
10 |1500

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

Upvote
Accepted
20.3k 73 10 20

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 5.0 MiB each and 10.0 MiB total.

Upvote
1.5k 3 5 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 5.0 MiB each and 10.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)

Click below to post an Idea Post Idea