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?

Best Answer

  • EMA does not support batch close yet.

    image

    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.

Answers

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

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