question

Upvotes
Accepted
13 1 1 9

groupId RsslBuffer type to std::string

Below is Description of groupId:

The groupId with which this information is associated. This is typically represented as a series of 2-byte unsigned integers (i.e. two-byte unsigned integers written directly next to each other in the buffer). The example provided in the RANGE / EXAMPLE column of this table shows such a series, with inserted dots to help indicate two-byte value. When encoded into a buffer, do not include dots.

What is the proper way to copy/convert groupId into std::string so that groupId be stored and logged with human readable format?

I have tried the following:

const std::string groupId{msg->refreshMsg.groupId.data, msg->refreshMsg.groupId.length};

const std::string_view groupId{msg->refreshMsg.groupId.data, msg->refreshMsg.groupId.length};

elektronrefinitiv-realtimeelektron-sdkrrteta-apielektron-transport-apirssl
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.

Upvote
Accepted
9.7k 49 38 60

Hi @tinmyo.win,

The buffer can contain a series of 2-byte blocks, in network byte order, representing the groupID. As such, try iterating through the buffer and assigning the 2 bytes into an unsigned short. That is

Note: ETA also has an example of how they dump the groupID using the 'xmlDumpMsgBegin' function.

Here is an example of the output from above:


ahs2.png (8.2 KiB)
ahs.png (14.1 KiB)
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.

Thanks for the code snippet. I am able to extract groupId correctly now.

Can you please also point me to how to create RsslBuffer with different length of groupId? The reason is transport API document states that a consumer needs to handle group Id with variable length such as "1.26.102". We requested different security type and different symbols but we have seen only group Id response with single 2-byte integers. We would like to create test cases with groupId, that has series of 2-byte integers.

Upvote
9.7k 49 38 60

Hi @tinmyo.win,

EDIT: The answer below was based on testing against an EMA IProvider Training example that set the group ID. However, through further testing, it appears the example does not properly assign the group ID based on network byte order. I will need to confirm with the development team. Please refer to the first answer above for the actual algorithm to process the group ID.

First thing, I updated my answer above to correct the algorithm to properly extract the 2-bytes and store within an unsigned short. Instead of:

unsigned short id = (groupId->data[i] << 8) | groupId->[i + 1];

It now reads:

unsigned short id = (groupId->data[i] | groupId->[i + 1] >> 8);

To create a test case that has a series of 2-byte integers, one way is to utilize one of the EMA IProvider Training examples, specifically 250__GroupStatus__Fanout. In there, you can modify the code to add additional groupIds. For example, I defined a new ID called: 'secondaryGroupId = 19', i.e.

You can add as many as you want to test. Then I simply added the following line within the AppClient::processMarketPriceRequest() method:

You can then take your ETA consumer application and test it against this Provider and you should see 2 ID values (10 and 19) displayed.


ahs.png (2.5 KiB)
ahs.png (4.1 KiB)
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.

Hi @nick.zincone.1, we have been strictly using Eta API and sink_driven_source + ADS as our provider. Is there anyway we can create groupId RsslBuffer with Eta API?

Hi @tinmyo.win,

I understand you are strictly using the ETA API, but to setup a simple provider to test is the easiest way given the EMA examples are packaged alongside the ESDK package. You don't have to download / install any separate software to make this work.

That being said, if you have to setup a test that must be written in ETA, I would ask this as a separate question. It helps guide the community to find answers. We don't want to see multiple questions within one post.

is anything wrong with ?:

unsigned short id = (groupId.data[i] << 8 | groupId.data[i+1]);

I am unable to parse group ID with updated answer you have provided below:

unsigned short id = (groupId.data[i] | groupId.data[i + 1] >> 8)

Hi @tinmyo.win,

Yes, the first formula I gave didn't manipulate the bytes correctly. The 2nd formula is correct. What do you mean "unable to parse"? I just tried it again without issue.

@nick.zincone.1 with new algorithms below you suggested:

unsigned short id = (groupId->data[i] | groupId->[i + 1] >> 8);

I noticed that all the groupIds are parsed as "0". I ended up using the first algorithm you shared. The first algorithms seem to be working fine as far as I know since I have been testing with large amount of symbols in real endpoints. That's the reason I would like to know is there any situation where the first algorithms won't handle the bit shift correctly.

If my understanding is correct, the second algorithms uses the bits in the first byte of groupId while the first algorithms uses the bits in the second byte of the groupId. Thanks for your feedback!

Hi @tinmyo.win,

Yes, the value I see when testing against my ADS does come back as zero (0) for the 2nd algorthm - the 1st algorithm, the value I received was 1. The reason I believe the 2nd algorithm is correct is because when I tested the against the Provider, the values came back correct. The 1st algorithm resulted in incorrect values.

Why do you believe the value zero (0) is incorrect?

Show more comments
Click below to post an Idea Post Idea