question

Upvotes
Accepted
301 6 17 27

Closing a batch stream in EMA

Looking in the EMA C++ documentation, I could not find any mention of closing a streaming batch of items. While I'm aware you can close a specific item, I could not find any guidelines around closing a batch, so I assumed it was similar to closing a single streaming item.

However, I was wrong.

When you perform a registerClient() on a consumer for a single item, you can use the returned handle to unregister that item, i.e.

UInt64 handle = ommConsumer.registerClient(<single item>);

...

ommConsumer.unregister(handle);

However, despite being intuitive, you can't do this with a batch. When you do, it will throw an exception that contains the error text:

"Invalid attempt to close batch stream. Instance name='Consumer_1_1"

The error message doesn't say you can't close a batch stream, but rather it was an invalid attempt. Fair enough. What is the valid way to do this? Can someone point me to where this is documented?

elektronrefinitiv-realtimeelektron-sdkrrtema-apielektron-message-apic++batch
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
4.4k 10 6 9

EMA does not support batch close yet.

So right now, you have to close single batch item one by one. You can get the handle of each batch items during onRefreshMsg callback.


emabatchclose.png (39.4 KiB)
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.

Upvotes
11.3k 25 8 13

You cannot call unregisterClient with a batch request handle to close all items in the batch request. This is because the batch request stream will automatically be closed, once the request is successfully sent.

You still need to close individual item stream with item handle. To retrieve item handle for item opened via batch request, you can call the getHandle() on the OmmConsumerEvent event in the onRefreshMsg() call back function.

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.

how can we close the item using handle?

As mentioned above you call ommConsumer.unregister(handle);

Hi @malika.gupta ,

When you receive the "handle" for each item, as described by Veerapath,

you can unregister, as described by Rupert:

void unregister(long handle)
Relinquishes interest in an open item stream.
Click below to post an Idea Post Idea