EMA Java: Possible to use Batch and View at the same time?
Hi,
I run `example360__MarketPrice__View` and `example370__MarketPrice__Batch`. Both worked fine.
I would like to combine Batch and View to reduce heap consumption.
But the following code, which I tried to merge example360 into example370, leads to an error.
public class Consumer
{
public static void main(String[] args)
{
OmmConsumer consumer = null;
try
{
AppClient appClient = new AppClient();
consumer = EmaFactory.createOmmConsumer(EmaFactory.createOmmConsumerConfig().host("10.15.1.52:14002").username("new_user"));
OmmArray arrBatch = EmaFactory.createOmmArray();
arrBatch.add(EmaFactory.createOmmArrayEntry().ascii("/7203.T"));
arrBatch.add(EmaFactory.createOmmArrayEntry().ascii("/2432.T"));
ElementList batch = EmaFactory.createElementList();
batch.add(EmaFactory.createElementEntry().array(EmaRdm.ENAME_BATCH_ITEM_LIST, arrBatch));
OmmArray arrayView = EmaFactory.createOmmArray();
arrayView.fixedWidth(2);
arrayView.add(EmaFactory.createOmmArrayEntry().intValue(6));
arrayView.add(EmaFactory.createOmmArrayEntry().intValue(22));
arrayView.add(EmaFactory.createOmmArrayEntry().intValue(25));
ElementList view = EmaFactory.createElementList();
view.add(EmaFactory.createElementEntry().uintValue(EmaRdm.ENAME_VIEW_TYPE, 1));
view.add(EmaFactory.createElementEntry().array(EmaRdm.ENAME_VIEW_DATA, arrayView));
consumer.registerClient(EmaFactory.createReqMsg().serviceName("ELEKTRON_DD").payload(view).payload(batch), appClient);
Thread.sleep(60000); // API calls onRefreshMsg(), onUpdateMsg() and onStatusMsg()
}
catch (InterruptedException | OmmException excp)
{
System.out.println(excp.getMessage());
}
finally
{
if (consumer != null) consumer.uninitialize();
}
}
}
And the error is:
11 10, 2016 6:38:36 午後 com.thomsonreuters.ema.access.SingleItem rsslSubmit
重大: loggerMsg
ClientName: SingleItem
Severity: Error
Text: Internal error: rsslChannel.submit() failed in SingleItem.submit(RequestMsg)RsslChannel 0
Error Id -1
Internal sysError 0
Error Location ItemHandler.extractViewFromMsg
Error Text :ViewData element not found <-26>
loggerMsgEnd
Also, when I swap the order of `.payload(view).payload(batch)` to `.payload(batch).payload(view)`, the error is:
Failed to open or modify item request. Reason: ReactorReturnCodes.FAILURE. Error text: :ItemList not found.
11 10, 2016 6:52:24 午後 com.thomsonreuters.ema.access.SingleItem rsslSubmit
重大: loggerMsg
ClientName: SingleItem
Severity: Error
Text: Internal error: rsslChannel.submit() failed in SingleItem.submit(RequestMsg)RsslChannel 0
Error Id -1
Internal sysError 0
Error Location WlItemHandler.handleBatchRequest
Error Text :ItemList not found.
loggerMsgEnd
Could you tell me how to use both Batch and View at the same time?
Thank you.
Best Answer
-
The Batch and View elementEntry needs to be in the same element list. Please try the following code.
ElementList batchView = EmaFactory.createElementList();
OmmArray arrBatch = EmaFactory.createOmmArray();
arrBatch.add(EmaFactory.createOmmArrayEntry().ascii("/7203.T"));
arrBatch.add(EmaFactory.createOmmArrayEntry().ascii("/2432.T"));
OmmArray arrayView = EmaFactory.createOmmArray();
arrayView.fixedWidth(2);
arrayView.add(EmaFactory.createOmmArrayEntry().intValue(6));
arrayView.add(EmaFactory.createOmmArrayEntry().intValue(22));
arrayView.add(EmaFactory.createOmmArrayEntry().intValue(25));
batchView.add(EmaFactory.createElementEntry().array(EmaRdm.ENAME_BATCH_ITEM_LIST, arrayBatch));
batchView.add(EmaFactory.createElementEntry().uintValue(EmaRdm.ENAME_VIEW_TYPE, 1));
batchView.add(EmaFactory.createElementEntry().array(EmaRdm.ENAME_VIEW_DATA, arrayView));
consumer.registerClient(EmaFactory.createReqMsg().serviceName("ELEKTRON_DD").payload(batchView), appClient);0
Answers
-
Thank you, it worked!
BTW, what does `1` mean in batchView.add(EmaFactory.createElementEntry().uintValue(EmaRdm.ENAME_VIEW_TYPE, 1)); ?
0 -
The ViewType specifies content type of ViewData array. '1' means list of Field ID and '2' means list of Element Name.
In this case and other View for MarketPrice domain items, the View array needs to be list of Field ID, so the ViewType always is '1'.
Below is the related information in the EMA RDM Usage Guide document provided in the EMAJ package.
0 -
Got it, thank you!
0 -
@veerapath.rungruengrayubkul ; I would like to use viewType of 2 and it is not working. Basically, I want to request data via standard field names like "ASK", "BID", etc. My domain is "MarketPrice Domain".
Any idea why it is returning all the fields instead? viewType of 1 works when I int fields (22, 25).
Regards,
josa
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
- 370 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 中文论坛