question

Upvotes
Accepted
301 6 17 27

How to use a pre-encoded ElementList in a message Payload?

I have entire ElementList pre-encoded in a buffer. How that buffer should be used to populate the list in a message payload?

RsslBuffer listBuffer; // a buffer with encoded element list in it, 160 bytes
RsslElementList list;
rsslClearElementList(&list);
list.flags = RSSL_ELF_HAS_STANDARD_DATA;
list.encEntries = *preencodedListBuf;

// when I try to encode the list in a message, the list is always empty
rsslEncodeElementListInit(&iter, &list, 0, 0);
rsslEncodeElementListComplete(&iter, RSSL_TRUE);
// rsslGetEncodedBufferLength(&iter) == 51 – list is not populated

Unfortunately, I was not able to find much info of how to use encEntries neither for ElementList nor for FieldList.

Is this the right way to populate msg payload with pre-encoded ElementList? If not – what is the right one? If yes - what am I possibly doing wrong?

elektronrefinitiv-realtimeelektron-sdktrepbufferjson-payloadencoding
icon clock
10 |1500

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

1 Answer

Upvotes
Accepted
488 12 13 27

Set the RsslMsg::encDataBody member directly to the buffer that contains your pre-encoded ElementList, e.g.

msg.msgBase.encDataBody.data = "";

msg.msgBase.encDataBody.length = listBuffer.length;

Or, just:

msg.msgBase.encDataBody = listBuffer;

When you call rsslEncodeMsg() the buffer contents will be encoded as the payload.

icon clock
10 |1500

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

Click below to post an Idea Post Idea