crash when construct UpdateMsg with name field
My sample code as follows:
{
emaaccess::UpdateMsg msg;
msg.name("hello");
fprintf(stderr, "process update msg with name:%s", msg.getName().c_str());
}
The app will crash when calling getName(), why ? I already called name() function to set this field.
Best Answer
-
Hi @iscas.wang
A couple of things here.
- you are trying to change the RIC name of an open stream - i.e. the RIC would have been set in the Refreshmsg, and then you are trying to change it in the UpdateMsg. To change the name of an existing item you would have to close the existing stream and send a new RefreshMsg with ClosedRedirectedEnum - to tell the consumer the item has been renamed, with the new Item name included in the RefreshMsg - so that the consumer can re-request using the new RIC name
- Also, my understanding is that you cannot just decode a message that has just been encoded - although from your limited code snippet it would appear you have not yet completed encoding the message anyway.
Please the following existing post for one way achieving this decode of just encoded object in EMA C++ - Forum | Refinitiv Developer Community I understand that you would have to complete encoding the message before you can decode it using the above technique,
0
Answers
-
@umer.nalla Thanks for your reply. I read the article you provided, It seems the decode only works for FieldList, not for UpdateMsg or RefreshMsg.
I read the source code for UpdateMsg.cpp, it seems that Updatemsg::name() method stores the name value in MsgEncoder object pointer(which actually points to UpdateMsgEncoder) with following code:
UpdateMsg& UpdateMsg::name( const EmaString& name )
{
if ( !_pEncoder )
_pEncoder = g_pool._updateMsgEncoderPool.getItem();
_pEncoder->name( name );
return *this;
}
void UpdateMsgEncoder::name( const EmaString& value )
{
acquireEncIterator();
#ifdef __EMA_COPY_ON_SET__
_nameSet = true;
_name = value;
#else
_pName = &value;
#endif
}But when calling getName(), it uses MsgDecoder object pointer which is unitialized with default NULL value. The application will crash on getName().
const EmaString& Msg::getName() const
{
return _pDecoder->getName();
}My usage scenary is simple. I just want to construct one UpdateMsg with field list payload and also its ric name. And later I want to extract the ric name for some usage. If I can't use UpdateMsg::name() field to store the ric name and use Msg::getName() to get the ric name again, Then I must construct another struct type with one filed storing the ric name and another UpdateMsg with field list payload.
0 -
Unfortunately, the Encoder and Decoder are separate from each other and therefore I believe you will have to use your own struct etc to store the RIC name for later usage.
0 -
@umer.nalla OK, so constructing my own struct to store ric and UpdateMsg is the only current solution. By the way, may I know why Encoder & Decoder are seperate from each other ? For example, I constructed one UpdateMsg and call toString() to decode the message. (As I previously pointed on the link you provided, decode just encoded object worked on FieldList, but not on UpdateMsg). Many thanks.
0 -
testffffffffffffffffffffffffffffffff
0 -
In the other example, it is using a StaticDecoder where it is passing in the completed FieldList and the dictionary to decode the completed fieldlist.
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
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛