In my Elektronsnap client, which is written in C++, the consumer object is created like this:
consumer.registerClient(ReqMsg().serviceName("ELEKTRON_DD").payload( ElementList().addArray(ENAME_BATCH_ITEM_LIST, ommarr).complete()).interestAfterRefresh( false ), client);
and the dispatch() method is called by 10 microseconds:
consumer.dispatch( 10 );
On the run I got lots of onStatusMsg with state OmmState::TimeoutEnum. I need the data about the timed out items. Could you tell me what is the best way to get this data?
This could be a request timeout in the EMA API. The default value is 15 seconds.
With this default value, the consumer will wait for a response to a request for 15 seconds before sending another request. If this happens, the application will get the following status message.
Item State: Open / Suspect / Timeout / 'Request timed out.'
The stream state is still open which means that the API will do an item recover on behalf of the application. Typically, the application just calls consumer.dispath until it gets all data.
If the application requests a lot of items, you may increase the value of RequestTimeout in the consumer and wait for the API to get the data.
Otherwise, instead of depending on the EMA API to recover items, the application can perform its own recovery logic by unregistering the handles of those timeout items and then sending a new batch request for those items.
When you receive a status message via onStatusMsg, you can query the details related to the data item by accessing the .getName(), .getServiceName() etc from the StatusMsg interface. For example, you can refer to EMA Consumer - Decoding MarketPrice data tutorial source code for an example. In there, you will find a code snippet showing how to extract details related to a status message:
I'm showing the code snippet where some details are extracted. In addition, you can see other attributes available to you using Visual Studio's intellisense.