EMAJ: How to keep long connection to server in OMMConsumer?

I have decoded the data from the host in Consumer. But how to keep a long connection to the host? such as heartbeat sending(I found it by using channel.ping() in ETAJ doc, but I don't konw how to do in EMAJ Consumer). Will the host send heartbeat package? if yes, how to deal with it?

Best Answer

  • Hello @Raj.Huang,

    EMA Java provides the ping management via its underlying layer (i.e. ETA Java). That's why you can't see this topic in EMA Java.

    The only option is that you can specify the ping or heartbeat value through the EMA Java's configuration parameter named 'ConnectionPingTimeout' as you can see its detail in the EMAJ_ConfigGuide.pdf document (see the excerpt below).

    image

    Anyway, there is a concern regarding ping management from ETA_DevGuide.pdf as follows:

    image

    According to the document, the server's minPingTimeout seems to have a higher priority when the application tries to negotiate the final ping value anyway.

    Hope this helps!

Answers

  • Nipat Kunvutipongsak,

    Thanks for your reply. I got it!

    But when the server disconnects, what will EMAJ consumer do?

    Will EMAJ send some exceptions out(maybe ErrorClient.class)? Thus I can know the connect is broken, then I can do something to reconnect.

    Or will EMAJ help me reconnect when it detects disconnection?

    Thanks if getting your reply!

  • Hi, I got the answer from Wasin Waeosri, it will reconnect itself, thank you all!