What's the differrence between EMAJ consumer and ETAJ consumer?

I supposed that EMAJ is a better version to use, it includes some part of the ETAJ.

But I don't find the heartbeat part, in ETAJ doc , channel.ping(error) method can send the ping, but how to do in EMAJ consummer? Please help me, because it's urgent.

Best Answer

  • wasin.w
    wasin.w admin
    Answer ✓

    Hi @Raj.Huang

    Basically, when the API is disconnected from server (server down, connection lost, etc), the application will receive notification via the OmmConsumerClient's onStatusMsg() callback function from the API. The example of server down notification is following

    StatusMsg
    streamId="5"
    domain="MarketPrice Domain"
    state="Open / Suspect / None / 'channel down.'"
    name="IBM.N"
    serviceId="50888"
    serviceName="ELEKTRON_DD"
    StatusMsgEnd

    The EMA Java API will try to reconnect and recover subscriptions to the server for the application. The application does not need to manual connect and re-subscribe data. Once that TREP server is back online, the API will automatic reconnect and resubscribe items for the application.

    I suggest you check the Elektron Message API Java Quick Start page to run the EMA Java examples which will give you more information about how the API handles connection for the application.

    Please note that the EMA Java example is hard coded to run for 60 seconds before calling the OMMConsuer.uninitialize() function to log out and disconnect from server. You need to change the 60000 milliseconds value to make it run longer.

Answers

  • Hello @Raj.Huang

    Basically, the EMA Java API maintains a connection between the API and server for the application. The application does not need to manual send ping to the server, the API automatically does it for the application. The API keeps connects to the server until the application call OMMConsuer.uninitialize() function.

    Why do you need to manual send ping?

    Please note that EMA API is not "a better" API than ETA API. It is the higher level and easier to implement API. If the application needs the high performance and what to manual control everything, ETA API which is a lower level API is a better option.

  • Wasin Waeosri,

    Thanks for your reply. You mean I don't be concern about the lost of connection ? But in case the server is offline, shouldn't we receive the notification right away? To avoid this situation, the general way is to send/detect heartbeat package, right?

  • Thank you very much! I got it!

  • ETA and EMA are both part of the Elektron SDK. EMA (Elektron Message API) is the higher level ease of use entry point and ETA (Elektron Transport API) is the lower level transport layer API. Because ETA is lower level, it does require the user to manage things like heart beats, while EMA does not since it does this for its users. ETA provides more flexibility and configurability to allow a wide variety of use cases and lowest latency/highest throughput but will require more code to use it and more understanding of the underlying system and network. EMA is built on top of ETA and leverages the same functionality, but takes care of many things on behalf of the user to make the application space as simple and straight forward as possible.

    You may want to take a look at the API Concepts guide that is in the Docs folder of the Elektron SDK distribution package. Chapter 2 gives a high level description of the various APIs and talks about the tradeoffs, performance, and different functionalities expected by the user vs. API. This should help you understand both so you can choose the entry point that makes most sense for you.