Can I simulate the reuters to send item messages to my own application?
There's some problems happend in my application, can I simulate the reuters to send item messages to debug to find reasons?
Best Answer
-
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!
0
Answers
-
@Raj.Huang:
"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.
0 -
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>0 -
OK, thank you very much, I will try.
0 -
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.
0 -
Hello @Raj.Huang,
OmmIProviderImpl locates in (1) <ELEKTRON_PACKAGE>/Ema/Src/main/java/impl and (2) ema.jar (in <ELEKTRON_PACKAGE>/Ema/Libs).
My project includes OmmIProviderImpl.java from location 1 and it has higher precedence than the class file in ema.jar (location 2) as you can see below.
0 -
Regarding the state != null logic, the code in the ema.jar file doesn't have this condition, so if it tries to publish the status data, the NullPointerException will be thrown from this OMMProviderImpl. That's why I told you to add the logic to avoid the error.
// Publish a plain STATUS message.
provider.submit( EmaFactory.createStatusMsg(), appClient.itemHandle );Here this is the result if the application tries to publish a STATUS message that doesn't contain a state attribute.
Hope this can explain why I try to convey you to modify this OmmIProviderImpl.java first.
0 -
OK, it works! Thanks you !
0
Categories
- All Categories
- 6 AHS
- 39 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 60 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛