20 1 3 5

unregister() causes internal stack trace

I have written the simplest code example that returns a refresh message and it gets a internal stack trace on unregister(). What's wrong in these 40 lines?

OnMsgTest onMsgTest = new OnMsgTest(ommConsumer, symbol);
long handle = ommConsumer.registerClient(reqMsg.serviceName(source).name(symbol), onMsgTest);

and later

public void onAllMsg(Msg msg, OmmConsumerEvent consumerEvent) {
Long handle = consumerEvent.handle();
String s = "onAllMsg symbol=" + symbol + " handle=" + handle + " msg=" + msg.toString();;

and the stack trace [1;31mjava.lang.NullPointerException[m: [1;31mCannot invoke "com.refinitiv.ema.access.OmmConsumerClient.onRefreshMsg(com.refinitiv.ema.access.RefreshMsg, com.refinitiv.ema.access.OmmConsumerEvent)" because the return value of "com.refinitiv.ema.access.Item.client()" is null[m
[1mat[m com.refinitiv.ema.access.ItemCallbackClientConsumer.notifyOnRefreshMsg ([[m)
[1mat[m com.refinitiv.ema.access.ItemCallbackClient.processRefreshMsg ([[m)
[1mat[m com.refinitiv.ema.access.ItemCallbackClient.defaultMsgCallback ([[m)
[1mat[m com.refinitiv.eta.valueadd.reactor.Reactor.sendDefaultMsgCallback ([[m)

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

62k 173 45 65

@Patrick Sweeney

Thanks for reaching out to us.

The onAllMsg callback method is called before other callback methods, such as onRefreshMsg.

In the onAllMsg callback, the code unregistered an item handle from the consumer which means that it removed this subscription from the consumer. Therefore, when calling other callback methods, EMA may forget to check if the subscription has been removed which causes this NullPointerException.


If you are a Refinitiv Developer Connect (RDC) named user, you can submit this issue to the API support team via Contact Premium Support. Otherwise, you can report this issue on GitHub.

To avoid this issue, please don't call the unregister method in the onAllMsg callback method. You can call the unregister method in other callback methods instead.

Please feel free to reach out if you have any further questions.

1675820507833.png (40.2 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.