There's some problems happend in my application, can I simulate the reuters to send item messages to debug to find reasons?
Dear @Raj.Huang,
The easy way to send a STATUS message with NO_DATA is to use a simple example named IProvider (in package com.thomsonreuters.ema.examples.training.iprovider.series100.example100__MarketPrice__Streaming).
In this example, you need to modify the source code to send a STATUS message to downstream:
Original Code:for( int i = 0; i < 60; i++ ){ fieldList.clear(); fieldList.add(EmaFactory.createFieldEntry().real(22, 3991 + i, OmmReal.MagnitudeType.EXPONENT_NEG_2)); fieldList.add(EmaFactory.createFieldEntry().real(30, 10 + i, OmmReal.MagnitudeType.EXPONENT_0)); provider.submit( EmaFactory.createUpdateMsg().payload( fieldList ), appClient.itemHandle ); Thread.sleep(1000);}Modified Code:// To publish data forever instead of 60 second.for( int i = 0; true; i++ ){ if (i != 0 && i%10 == 0) { provider.submit( EmaFactory.createStatusMsg(), appClient.itemHandle ); } else { fieldList.clear(); fieldList.add(EmaFactory.createFieldEntry().real(22, 3991 + i, OmmReal.MagnitudeType.EXPONENT_NEG_2)); fieldList.add(EmaFactory.createFieldEntry().real(30, 10 + i, OmmReal.MagnitudeType.EXPONENT_0)); provider.submit( EmaFactory.createUpdateMsg().payload( fieldList ), appClient.itemHandle ); } Thread.sleep(1000);}
Also, you need to modify OmmIProviderImpl.java to avoid NullPointerException as well (see the code below):
Original Code:void handleItemInfo(int domainType, long handle, State state ){ if ( state != null && state.streamState() != StreamStates.OPEN ) { ItemInfo itemInfo = getItemInfo(handle); ...Modified Code:void handleItemInfo(int domainType, long handle, State state ){ // Add a logic to check null reference if ( state != null && state.streamState() != StreamStates.OPEN ) { ItemInfo itemInfo = getItemInfo(handle); ...
Then, you can run the example such as a Consumer application in com.thomsonreuters.ema.examples.training.consumer.series100.example100__MarketPrice__Streaming package to connect to this provider application. Here this is the excerpt result:
<!-- Incoming Reactor message --><!-- java.nio.channels.SocketChannel[connected local=/127.0.0.1:13933 remote=localhost/127.0.0.1:14002] --><!-- Wed Sep 27 17:40:55 ICT 2017 --><!-- rwfMajorVer="14" rwfMinorVer="1" --><UPDATE domainType="MARKET_PRICE" streamId="3" containerType="FIELD_LIST" flags="0x00" updateType="0" dataSize="15"> <dataBody> <fieldList flags="0x08 (HAS_STANDARD_DATA)"> <fieldEntry fieldId="22" data="0C14 BE"/> <fieldEntry fieldId="30" data="0E05 31"/> </fieldList> </dataBody></UPDATE><!-- Incoming Reactor message --><!-- java.nio.channels.SocketChannel[connected local=/127.0.0.1:13933 remote=localhost/127.0.0.1:14002] --><!-- Wed Sep 27 17:40:56 ICT 2017 --><!-- rwfMajorVer="14" rwfMinorVer="1" --><STATUS domainType="MARKET_PRICE" streamId="3" containerType="NO_DATA" flags="0x00" dataSize="0"> <dataBody> </dataBody></STATUS><!-- Incoming Reactor message --><!-- java.nio.channels.SocketChannel[connected local=/127.0.0.1:13933 remote=localhost/127.0.0.1:14002] --><!-- Wed Sep 27 17:40:57 ICT 2017 --><!-- rwfMajorVer="14" rwfMinorVer="1" --><UPDATE domainType="MARKET_PRICE" streamId="3" containerType="FIELD_LIST" flags="0x00" updateType="0" dataSize="15"> <dataBody> <fieldList flags="0x08 (HAS_STANDARD_DATA)"> <fieldEntry fieldId="22" data="0C14 C0"/> <fieldEntry fieldId="30" data="0E05 33"/> </fieldList> </dataBody></UPDATE>
Note that the IProvider example will exit immediately if you disconnect the consumer application from the provider. You need to restart IProvider to perform simulation again.
Hope this helps!
How do you connect to the market data system? There is no provision within infrastructure to resend messages for debugging. A developer can either use a publisher application (available in API samples) to send updates to a consumer app. There are also third party replay tools which record and replay market data at controlled rates. Both these approaches will require reconfiguring your app to connect to replay source rather than real time source.
HI @Gurpreet:
I connect by using emaj, OmmConsumer class. I want to know can I send "NO_DATA" message like below to my consumer app by using a provider app?
<!-- Incoming Reactor message --><!-- java.nio.channels.SocketChannel[connected local=/192.168.2.170:32609 remote=/122.144.182.146:14002] --><!-- Tue Sep 19 14:42:39 CST 2017 --><STATUS domainType="MARKET_PRICE" streamId="5" containerType="NO_DATA" flags="0x08 (HAS_MSG_KEY)" dataSize="0"><key flags="0x07 (HAS_SERVICE_ID|HAS_NAME|HAS_NAME_TYPE)" serviceId="257" name="JPY=" nameType="1"/><dataBody></dataBody></STATUS>
OK, thank you very much, I will try.
Hi @Nipat Kunvutipongsak,
I have some questions in the step of "modify OmmIProviderImpl.java to avoid NullPointerException as well".
Firstly, as you said, OmmIProviderImpl.java is a source code, so I should change it in your way, then package into the ema.jar and replace the original one, right?
Can you give a detail solution for change the source code "OmmIProviderImpl.java"?
Secondly, there is no "state != null" check in the original code, right? I suppose you make a copy error.