Unconditional Consumer API or stops when no msgs to consume?

Aalim
Aalim Newcomer

Please clarify with below code snippet, when the consumer stops consuming the data from ADS? The reason for this question would be, it consumes the market data continuously when I comment out the finally block below but stops consuming when there is a finally block. I understand the use of finally here but on the other side is what I'm trying to. Does consumer stops whenever there is no update message or there is any configuration concept to understand behind it? On what time out basis does consumer continue to consume the data when there is no finally block? Any lights on this would be great to understand better.

batch.add(EmaFactory.createElementEntry().uintValue(EmaRdm.ENAME_VIEW_TYPE, 1));
batch.add(EmaFactory.createElementEntry().array(EmaRdm.ENAME_VIEW_DATA, view_data_array));

consumer.registerClient(EmaFactory.createReqMsg().serviceName("FINANCE_PRICES").payload(batch), appClient);
Thread.sleep(60000);    // API calls onRefreshMsg(), onUpdateMsg() and onStatusMsg()
} catch (InterruptedException | OmmException excp) // views last_traded limit the consumer resp
{
 LOG.info(excp.getMessage());
} finally {
    if (consumer != null) consumer.uninitialize();
}



Best Answer

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    Answer ✓

    @Aalim

    Thank you for reaching out to us.

    After the consumer can connect and login to the server, the consumer will maintain a connection to the server. As long as the connection is alive, the API can consume data from the server.

    To stop consuming data from the application, the application needs to cut the connection by uninitializing the consumer or exiting the application.


Answers