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