question

Upvotes
Accepted
17 3 4 2

Invalid attempt to close batch stream. Exception thrown in thomsonreuters::ema::access::OmmInvalidUsageExceptionImpl

Hi,

I have this issue with consumer.unregister() in EMA C++ SDK 1.4.0L1 as well in 1.5.0.L1.


The issue is that after I register a client (consumer is type OmmConsumer) using the batch mode, (thomsonreuters::ema::rdm::ENAME_BATCH_ITEM_LIST)

UInt64 handle = consumer.registerClient(...thomsonreuters::ema::rdm::ENAME_BATCH_ITEM_LIST...)

everything works OK except the unregister.

Calling consumer.unregister(handle); I get exception:

thomsonreuters::ema::access::OmmInvalidUsageExceptionImpl

and in EMA log file I do get:

Invalid attempt to close batch stream. Instance name='EmaConsumer_1'.


Unregister call (consumer.unregister(handle) ) works OK when I am NOT using BATCH mode.

This happens only for the BATCH mode consumer type.

Any ideas much appreciated.

Thank you,




elektronrefinitiv-realtimeelektron-sdkrrtema-apielektron-message-apic++OMMunregister
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.

1 Answer

Upvotes
Accepted
23.7k 84 10 22

Hi @Ionut T

The Batch handle is automatically closed by EMA once it makes the batch request - as each item has its own individual handle & stream established by the API - since each item is updated individually and therefore needs its own stream.

If you want to close the individual items you can extract the handle from the OmmConsumerEvent that you receive in your event handlers e.g.

void AppClient::onUpdateMsg( const UpdateMsg& updateMsg, const OmmConsumerEvent& ommEvent )
{
...
    _pOmmConsumer->unregister( ommEvent.getHandle() );
...
}

If you want to unregister all items you need to get hold of the Login handle as demonstrated in example 333__Login__Streaming__DomainRep

You can then unregister the Login handle - which will close all items and log you out from the server as well.



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.