EMA Java : Batch Request - How to detect if the response message is fully completed
I am interested to use EMA Batch Request to get the fields for a list of contracts
e.g. from EMA example370__MarketPrice__Batch consumer.registerClient(EmaFactory.createReqMsg().serviceName("REUTERS_DEV").payload(batch), appClient);
Thread.sleep(60000);// API calls onRefreshMsg(), onUpdateMsg() and onStatusMsg()
1) How can I listen to snapshot data only (no update)?
2) The examples use a thread.sleep((60000) after sending the request. How to determine how long it should sleep ?
3) How can I know if the fields of all Rics are returned ?
Tagged:
0
Best Answer
-
Hi @OX
- Yes, if you’re only interested in snapshot data (no updates)
you should disable updates with .interestAfterRefresh(false). - Waiting for a period of time is ok for an example but is not
a solution for a production application. Indeed, you cannot tell in advance how
long it will take to open all your RICs. Because of that there’s a risk that
either you do not wait long enough (and you miss some RICs) or you wait
unnecessarily too long. - As far as I know EMA doesn’t tell you when all
the item streams of your batch request are complete. I’m afraid that you will have
to preserve the status of each individual item (RICs) in order to understand if the batch request is complete or not. For every RIC that you requested in the
batch EMA will open a new item stream and send either:
- a Refresh message that
contains the whole list of fields of the item
or
- a Status message that potentially indicates a closed stream state and contains an error message.
Once you received either a Refresh message or a Status message
for all the RICs you requested, you know that you batch request is complete.
0 - Yes, if you’re only interested in snapshot data (no updates)
Answers
-
Hi @OX
- The ".interestAfterRefresh(false)" will let the application consumes data as a non-streaming (snapshot). The application will get only "refresh" data to the onRefreshMsg callback function and does not get any updates data.
- You can use the "user dispatch" mode which lets the application thread controls and manages all callbacks execute. Please see an example in EMA Java's example130_MarketPrice_UserDisp application
- The refresh data comes to application's onRefreshMsg always contains all fields data from TREP/Elektron (if the application uses View feature, it will contains all requested fields data)
Please see an example code from example130 below:
consumer = EmaFactory.createOmmConsumer(EmaFactory.createOmmConsumerConfig()
.operationModel(OperationModel.USER_DISPATCH)
.host("localhost:14002").username("user"));
consumer.registerClient(EmaFactory.createReqMsg().serviceName("DIRECT_FEED").name("IBM.N"), appClient, 0);
long startTime = System.currentTimeMillis();
while (startTime + 60000 > System.currentTimeMillis()) //The application controls how long for dispatching incoming events here
consumer.dispatch(10); // calls to onRefreshMsg(), onUpdateMsg(), or onStatusMsg() execute on this thread0
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 中文论坛