question

Upvotes
Accepted
1 0 0 0

Convert RefreshMsg(C++) to rsslRefreshMsg for encode then decode back

Hi I want to save RefreshMsg to file and later replay it. I saw the forum has getEncodedBuffer and setEncodedBuffer but I can't fine it in Ema. I saw there is an example in unit doing this:

rsslEncodeMsg(&encIter, (RsslMsg*)&refresh);

But what I have is RefreshMsg not rsslRefreshMsg, when I tried to do encoding above it seems fine. but when I decode it.

RsslMsg refreshDecode;
retval = rsslDecodeMsg(&decodeIter, (RsslMsg*)&refreshDecode);

It failed to decode here I think itis because already message is RefreshMsg not rsslRefreshMsg so c casting is not right. So I think I need to convert RefreshMsg to rsslRefreshMsg to encode it. But I don't know how.

refinitiv-realtimeema-api#technologyc++
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
Accepted
72.7k 225 49 71

@p

EMA provides an interface to access the hex buffer. For example:

void AppClient::onRefreshMsg( const RefreshMsg& refreshMsg, const OmmConsumerEvent& ) 
{
    cout << refreshMsg << endl;        // defaults to refreshMsg.toString()
    const EmaBuffer& buffer = refreshMsg.getAsHex();
    cout << "Length:" << buffer.length() << endl;
    cout << buffer.asRawHexString() << endl;
}

However, I can't find a way to convert the raw buffer back to RefreshMsg.

The unit test example (RTSDK-2.1.1.L1.win.rrg\Cpp-C\Ema\Examples\Test\UnitTest\RefreshMsgTests.cpp) shows how to use the StaticDecoder::setRsslData method to get an EMA RefreshMsg from an ETA RsslMsg. However, I think it is for testing purpose.

If you have Refinitiv Developer Connect (RDC) contacts, you can submit this query to the API support via Contact Premium support to verify this kind of usage. Otherwise, you can submit this question to the developer team directly via GitHub.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
72.7k 225 49 71

@p

Thank you for reaching out to us.

The Refinitiv Real-Time SDK contains two APIs (EMA and ETA). EMA is built on top of ETA.

EMA is the high level and ease of use API that operates data at the message level, such as RefreshMsg, and UpdateMsg. ETA is the low level and high performance API that operates data at the transport and buffer level. rsslEncodeMsg, rsslDecodeMsg, and RsslMsg are interfaces in ETA which don't work with EMA classes.

Moreover, the APIs don't provide any interfaces to convert EMA RefreshMsg to ETA RsslRefreshMsg, or vice versa.

If you would like to record and replay data, you can use the testclient and testserver tools. For more information, please refer to the Quick Start Guide to Recording and Playback of Refinitiv Real-Time Data article

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
1 0 0 0

We can't use testclient/testserver tools in our local and our production environment (they are closed source and we can't use them without breaking our security policy). We have to write code to encode/decode message. If eta is raw transport buffer level, when I get callback using EMA what I have is RefreshMsg, it means it converts rssl(ETA) to EMA. I must be able to get raw buffer and dump to disk, next time I can read it back and convert to EMA myself since this way the only difference is network buffer vs disk buffer. Please advise, how do I: 1) get hold on underlying buffer from RefreshMsg later on 2) how to convert saved buffer to RefreshMsg?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
1 0 0 0

Will do. Opening RDC ticket now, thanks.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.