question

Upvotes
Accepted
3 3 5 6

How do I request a RefreshMsg on an open stream?

I'm using ema-3.4.0.1.jar from Maven. I want to get a RefreshMsg periodically on a stream. According to https://community.developers.refinitiv.com/questions/55283/getting-an-ad-hoc-refreshmsg-while-stream-is-open.html , one solution is use reissue(), I tried it, but I didn't get a RefreshMsg after calling that function (while UpdateMsg continued to arrive). Do I need to configure the server and client in a particular way to make it work? I use API dispatch.

registerClient was called like this:

long handle = consumer.registerClient(EmaFactory.createReqMsg().serviceName("myServiceName").name("myItemName"), client, closure);

reissue was called like this

consumer.reissue(EmaFactory.createReqMsg().serviceName("myServiceName").name("myItemName"), handle);

Another question is it safe to call reissue while the callback thread is still executing? There was a deadlock bug mentioned in https://community.developers.refinitiv.com/questions/15831/ommconsumer-reissue-problem.html which seems to have been fixed.

elektronrefinitiv-realtimeelektron-sdkema-apirrtelektron-message-apirefresh-message
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.

Upvotes
Accepted
9.6k 10 7 7

Hello @-

According to my test with your given source code, I found that EMA did not sent the reissue request to the server. Hence, the application did not get a new Refresh message. However, if I changed something in the request e.g. priority (from default 1,1 to 2,2):

consumer.reissue(EmaFactory.createReqMsg().priority(2, 2), handle);

EMA sent the reissue request and I got a new Refresh.

Please refer to example301__MarketPrice__PriorityChange which showcases reissue.

You can enable EMA xml trace log which shows incoming and outgoing messages between EMA and the server by setting XmlTraceToStdout in Consumer node to be 1:

<Consumer>
            <Name value="Consumer_1"/>
            ...
            <XmlTraceToStdout value="1"/>
 </Consumer>
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.

Upvotes
3 3 5 6

@Pimchaya.Wongrukun

Thanks for the answer. Is it possible to get a RefreshMsg without changing the state (e.g. priority) of the stream? What I need is get a RefreshMsg at regular intervals. Is it safe to invoke reissue while the callback thread is still executing?

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.

Upvotes
9.6k 10 7 7

Hello @-

If you would like to get a Refresh message at regular intervals, another possible solution is to request snapshot periodically by setting interestAfterRefresh(false):

consumer.registerClient(reqMsg.serviceName("DIRECT_FEED").name("IBM.N").interestAfterRefresh(false), appClient);

For the complete example application, please refer to series100.example102__MarketPrice__Snapshot

Base on my test, while the callback thread is working in onRefreshMsg(..), the main thread which calls reissue(..) will not be invoked till the callback thread returns from onRefreshMsg(..). You may raise this issue to the development team via Elektron-SDK github.

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.

Upvotes
78.1k 246 52 72

@-

I have tried the below code to send a reissue request for a new RefreshMsg.

 consumer.reissue(EmaFactory.createReqMsg().serviceName("DIRECT_FEED").name("PTT.BK").initialImage(true), handlePTT);

It doesn't work in EMA Java. However, I have tried the same code with EMA C++ and it works fine. The application can get a new RefreshMsg properly.

Therefore, it could be a bug in EMA Java. If you are an RDC subscriber, you can submit a new case to the support team via Contact Premium Support.

Otherwise, you can create a new issue in GitHub.

EMA API is thread-safe so it is safe to invoke reissue while the callback thread is still executing.


1589880955438.png (45.3 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.

Upvotes
3 3 5 6

@Pimchaya.Wongrukun @jirapongse.phuriphanvichai

Thank you both for the answers. I can't use periodic snapshots as I need RefreshMsg in addition to UpdateMsg in the same stream. I've reported this bug on https://github.com/Refinitiv/Elektron-SDK/issues/143

In the meantime, as a workaround, I'll invoke reissue twice, the first one to set priority and second one to unset it.

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.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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