question

Upvotes
Accepted
48 8 17 19

question about OmmConsumer::unregister

Hello, everyone, i encountered a problem about using Consumer::unregister function. My application collected every returned handler returned from Consumer::registerClient( const ReqMsg& reqMsg, OmmConsumerClient& client, void* closure = 0, UInt64 parentHandle = 0 ) into a vector. Before my application quits, I iterate the vector , for each handler I called Consumer::unregister function, but the following errors occurs:

loggerMsg
    TimeStamp: 19:00:01.387
    ClientName: Consumer_1_1
    Severity: Error
    Text:    Invalid attempt to close batch stream. Instance name='Consumer_1_1'.
loggerMsgEnd

so Is there anything wrong about my calling Consumer::unregister() function? What's the correct way ?

One more question, if my application continues calling Consumer::register() to refresh each chain code, but never calling Consumer::unregister(), Is that still ok?

Appreciate for any help one may provide, thank you.

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.

Upvotes
Accepted
25.3k 87 12 25

Hi @wangfugen

The message indicates that you are trying to close a Batch request stream - using the handle returned when you called registerClient for your batch request.

When you make a Batch Request, the Batch Request Stream will be closed once it has been processed. This is because each item in the Batch will be allocated it is own unique stream ID - therefore you should not call unregister for the Batch stream.

If you wish to extract the handle for each valid open RIC in your Batch, you can do so in the callback handlers e.g. in onRefreshMsg handler

void AppClient::onRefreshMsg( const RefreshMsg& refreshMsg, const OmmConsumerEvent& ommEvent) 
{ 
.... 
.... 
    UInt64 handle = ommEvent.getHandle(); 
.... 
.... 
} 

Also, can you clarify your 2nd question about chain codes and register/unregister?

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
48 8 17 19

Hi, @Umer Nalla

According to your explanation, I suppose that I needn't collect returned handlers from Batch Request. Instead, If I want to unregister all RICs, I should collect handler via AppClient::OnRefreshMsg, and call unregister on that handler, is that right?

As for the second question, if I never call unregister on requested RIC handlers but make Batch Request everyday, is that ok ?

Many thanks for your advices.

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

Hi @wangfugen

Correct - you don't need to store the returned handle for batch request - you can collect from onRefreshMsg and use that handle instead.

2nd question - if your application is run continuously, and does not shutdown and you don't ever call unregister and continue to register new items, then your list of open items will continue to grow - is that what you want?

If, however, your application is shutdown every day, then you don't explicitly need to unregister each item. Each item stream will be closed, when you disconnect from the server.

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
48 8 17 19

Hi, @Umer Nalla

Yes, my application is running continuously and I wish to refresh RICs everyday to get more items. Now I shall try your solution. Thank you for your professional solution.

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

Hi @wangfugen

If you wish to subscribe to new RICs each day then, yes you can make new batch request for the new RICs each day.

If there are RICs you are no longer interested in, then you should unregister them, to minimise network bandwidth usage and maintain performance levels of your application.

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
48 8 17 19

Hi, @Umer Nalla

Yes, I will record all RICs handler in OnRefreshMsg callback and unregister all of them before making new batch requests the next day. Thank you.

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.

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.