question

Upvotes
Accepted
1 0 0 1

How can I decode a subset of fields from the summary data without reading every field?

I'm using UPA library to read and receive RWF messages, and with each MarketByPrice message I'm only interested in a subset of the summary data. Currently I'm having to decode every single field to find the data that I'm interested in, which is costly. Is there a way of only decoding the fields I'm interested in (e.g QUOTE_DATE and QUOTIM_MS). I've found the documentation around LocalFieldSetDefDb, but not quite sure this is the direction I'm supposed to follow. If it is, please could you give an example of how I could use LocalFieldSetDefDb to only read the summary data fields I'm interested in.

elektronelektron-sdkrrteta-apielektron-transport-apifieldsmarket-by-price
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

Upvote
Accepted
38.1k 71 35 53

You need to decode every field to find the fields that you are interested. However, you can skip decoding of the entry's contents by invoking the entry decoder to move to the next RsslFieldEntry. For example:

while ((retVal = rsslDecodeFieldEntry(&decIter, &fieldEntry)) !=
RSSL_RET_END_OF_CONTAINER)
{
	switch (fieldEntry->fieldId)
	{
	  case 3386: //QUOTE_DATE
		//Decode QUOTE_DATE
	  break;
	  case 3855: //QUOTIM_MS
		//Decode QUOTIM_MS
	  break;
	}
	//For other fields, skip decoding its content  
}

Set Definition is used to reduce overall encoded content by eliminating repetitive type and length information. It is not used to find the content. Moreover, it is used within the RsslMap's entries, not summary data.

For example, without set definition, the map entries in map will look like:

Each map entry will contain the FID 22 and 25.

However, with set definition, the map entries in map will look like:

FID 22 and 25 are moved to set definition and the field list contains only the field's data. It provide additional optimizations for the size of payload.

However, the application still needs to call decode for every field to get the data.


nosetdef.png (12.7 KiB)
withsetdef.png (11.5 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.

Click below to post an Idea Post Idea