How to avoid timeout status messages

Hi All,

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?

Thanks

Best Answer

  • Jirapongse
    Jirapongse admin
    Answer ✓

    @peter.meszaros

    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.

    image

    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.

Answers

  • Hi @peter.meszaros,

    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:

    image

    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.

  • Hi Jirapongse,

    When I set RequestTimeout to 0 then I got a few warnings followed by an error message:

    ClientName: LoginCallbackClient
    Severity: Warning
    Text: RDMLogin stream state was changed to suspect with status message
    State: Open / Suspect / Timeout / 'Request timed out.'
    ...
    Severity: Error
    Text: RDMLogin stream was closed with status message
    State: Closed / Suspect / Login rejected, exceeded maximum number of mounts per user / 'Exceeded maximum number of mounts per user.'

    But if I set RequestTimeout to 3600000 (1hour) then it works as expected. Anyways, now I have a working solution. Thanks a lot.

    Regards

  • Hi Nick,

    Thanks your comment. However my point is how to eliminate timeout, not how to get the message details.