FieldEntry copy
In EMA Java, is it possible to get and keep a copy of a FieldEntry ?
At the moment when i retrieve a message, i decode it and populate my own object.
My domain object has 2 hashtables, both indexed by the FieldID.
The first one contains the FieldEntry.load().toString(), while the second one contains the FieldEntry directly, in order to parse it later on depending on the type.
However, there are some issues when i retrieve multiple items successively, the map of FieldEntry always contain the fields of the last item requested.
Is it possible somehow to retain a copy of a FieldEntry for later use ?
Best Answer
-
It is by designed of the EMA API that it currently currently does not support cloning of the Data
objects and it internally reuses the FieldEntry and RefreshMsg
objects. This information has been described in the
warning section of section 3.2.3 “Data Class” in the EMA Java Development guide
document.If the application just needs the content for the
business logic use case, the application can store the FieldEntry’s content as
string (like your value hashtable).Otherwise, the application can create the local FieldEntry
object to cache data via the EmaFactory.createFieldEntry()
function by setting each information from the incoming FieldEntry to the new local FieldEntry object.0
Answers
-
Could you please share the code that initiate and keeps data into the Hashtable?
Do you have separate hashtable for each item or only hashtable for all items? Basically, if you put new value with the same key (FID) to the hashtable, it will update the current value to be the new one.
0 -
I have a domain object called ItemResult, which contains 2 hashmaps:
private final Map<Integer, String> values;
private final Map<Integer, FieldEntry> fieldEntries;An ItemResult represent one Record on TREP.
When i receive a RefreshMsg, i create a new ItemResult, and populate both hashtables with the fieldId as the Key, and either the FieldEntry.load().toString() for values or FieldEntry for fieldEntries.I suspect that internally EMA reuses the RefreshMsg object, as well as the FieldEntry objects.
0 -
(Assuming similar behavior with EMA c++)
Every time you call .forth() on FieldList, private object (of type FieldEntry) within FieldList is being overwritten with a new value. And when you call .getEntry() -- reference to this internal object is returned.
So all your references to FieldEntries that you stored will be pointing to same internal object. That means you should manually clone state of FieldEntry and put it in your hashtable, because otherwise this FieldEntry will be overwritten after next .forth() call.
0 -
That was my guess indeed, hence my question asking about how to properly clone the FieldEntry object, since it doesn't implement Cloneable.
0 -
Hi @GAUTHIER.ROEBROECK I modified EMA example based on your application logic as following steps:
- subscribe two items
- the first items (EUR=) subscribes for FIDs 114 and 372
- the second items (VOD.L) subscribes for FIDs 22 and 25
- create two instances of itemresult objects for EUR= and VOD.L based on your logic
- when each subscription receives refresh data, put incoming FID and FieldEntry to the itemresult's hashtable
- when each subscription receives update data, print out the refresh's FieldEntry in the itemresult's hashtable
I found that sometime, the hashtable's FieldEntry returns FID and data of the recent another item incoming data, not the it's refresh data. The values hashtable (string) does not encounter the same problem.
Example:
----- EUR= got update -----
onUpdateMsg: Item Name: EUR=
incoming data Fid: 114 Name = BID_NET_CH DataType: Real Value: 0.0027
incoming data Fid: 372 Name = IRGPRC DataType: Real Value: 0.25
----- VOD.L got update -----
onUpdateMsg: Item Name: VOD.L
----- Print out VOD.L refresh that should has only 22 and 25 FIDs -----
The Refresh message is
Data for: = VOD.L
Fid: 372 Name = IRGPRC DataType: Real
0.25
Fid: 114 Name = BID_NET_CH DataType: Real
0.0027
----- VOD.L hashtable's FieldEntry shows recently EUR= FIDs instead -----Is it the similar behavior as your problem?
0 -
Actually on my side I am only doing snapshot requests, so i only receive Refresh messages.
Also, all the items i request usually have the same fields, and i request all the fields for each item.
But i think you experience kind of the same behavior as me, basically the FieldEntry may be reused internally by EMA.
0 -
Hi @GAUTHIER.ROEBROECK,
did you manage to achieve your aim? If so, could you please explain your approach?
I have the very same requirement: caching the payload of an OMM (MarketPrice) update for later use, but I can't find any clear way to copy a FieldEntry instance using directly EMA (C++).@GAUTHIER.ROEBROECK, @Wasin Waeosri, in case a custom solution is needed, could please share any recommendations, best practices or snippets to do it in the right way?
It would be very much appreciated.Thanks
Kind Regards,
Paolo
0 -
In the meantime, I've found some useful information here.
Regards,Paolo
0
Categories
- All Categories
- 6 AHS
- 39 Alpha
- 162 App Studio
- 4 Block Chain
- 5 Bot Platform
- 17 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 中文论坛