question

Upvotes
Accepted
2 1 2 2

beginner question: unsubscribe from a RIC

I am sorry if this is too basic but I do not see it in the examples or docs I was provided.

I can subscribe to a RIC.... but once I am done with it how do I unsubscribe?

I subscribe via:

thomsonreuters::ema::access::OmmConsumer *pConsumer
pConsumer->registerClient( ReqMsg().serviceName( "ELEKTRON_DD" ).name( RicName ), *this );
elektronrefinitiv-realtimeelektron-sdkema-apirrtelektron-message-api
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.

Hello @jtalvy,

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
32.2k 40 11 20

Hello @jtalvy,

If all you need is a snapshot, a better way would be to register interest:

consumer.registerClient( ReqMsg().serviceName( "ELEKTRON_DD" ).name( "IBM.N" ).interestAfterRefresh( false ) , client );

Please refer to Consumer examples that came with EMA C++ SDK, Consumer 101, Snapshot

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
25.3k 87 12 25

Hi @jtalvy

Please see example 300_MarketPrice_Close

_pOmmConsumer->unregister( ommEvent.getHandle() );

The above is called from the onUpdateMsg() callback handler - so it has easy access to the handle of the item stream it wants to close.

If you want to close the item stream from a point where you don't have an event related to the particular item, then you will need to store the handles e.g. in a lookup table or inside any structure or class you may be using to represent the item within your application.

The handle is returned when you first call registerClient e.g.

UInt64 handle = pConsumer->registerClient( ReqMsg().serviceName( "ELEKTRON_DD" ).name( RicName ), *this );
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.

Upvotes
2 1 2 2

Great thx! If I just need a snapshot I will do:

void AppClient::onRefreshMsg( const RefreshMsg& refreshMsg, const OmmConsumerEvent& event)
{
        if (DataType::FieldListEnum == refreshMsg.getPayload().getDataType())
                decode(refreshMsg.getPayload().getFieldList());
	pConsumer->unregister( event.getHandle() );
}


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.

Hi @jtalvy,

To perform a snapshot, you simply specify that your request is non-streaming. That is:

UInt64 handle = pConsumer->registerClient( ReqMsg().serviceName( "ELEKTRON_DD" ).name( RicName ).interestAfterRefresh(false), *this );

By doing this, you will only receive the initial image and the stream will automatically close. You can refer to example 102_MarketPrice_Snapshot.

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.