Hello,
Are there any examples provided in EMA SDK to parse page based data?
Thank you.
NWM
Hello @NWM
You can use example102__MarketPrice__Snapshot to send a snapshot item/RIC request to snapshot the page. Hence, you will get only a refresh message containing the latest data of all available fields of the RIC at that time; there is no any update message after the refresh message. The example calls ReqMsg.interestAfterRefresh(false) to specify that snapshot item is requested as code below:
consumer.registerClient(reqMsg.serviceName("DIRECT_FEED").name("IBM.N").interestAfterRefresh(false), appClient);
Whenever the application want to snapshot the page, it needs to send a snapshot RIC request by calling consumer.registerClient(..) as the source code above.
Normally, a page is shown via the field named ROW64_1(field id 215) to ROW64_14(field id 228) or ROW80_1(field id 315) to ROW80_25(field id 339). Please refer to decode(FieldList fieldList) method in example120__MarketPrice__FieldListWalk which shows how to get the field id.
The example of a page display in ROW64_n fields:
The example of a page display in ROW80_n fields:
Hello @NWM,
The page can be update partially by the provider sends an intra-field positioning sequencewithin the data field. Hence, the application requires additional steps for processing anupdate message to display the correct data of the field.
The syntax of an intra-fieldpositioning sequence is as follows:
Where:
The 0x60 byte signals the termination of the partial updatepositioning sequence. n is a set of numeric digits (0x30 through 0x39) thatrepresent the byte offset position relative to the start of the field. Countingbegins with the first byte position being number 0 (zero).
For example, the applicationreceives a refresh message with Field Id 317 is:
7189 4378 3077 6438 | 6438 6387 3269 5465
and the following update is received:
FIELD_ENTRY 317: 1b5b313460343433202037383137
Hex "1b5b313460343433202037383137" means update thefield at position 14 with “443 7817”
Then after the update is processed, the data of field 317 thatthe application should display is:
7189 4378 3443 7817 | 6438 6387 3269 5465
EMA provides RmtesBuffer.apply() to interpret the intra-field position. Even there is no example to parse page data in EMA but you can modify example120__MarketPrice__FieldListWalk shipped with EMA Java package to parse page data as the snipped source code below:
class AppClient implements OmmConsumerClient{ //a Map keeps field Id as a key with RmtesBuffer TreeMap <Integer, RmtesBuffer> rmtesMap = new TreeMap <Integer, RmtesBuffer>(); … void decode(FieldList fieldList) { Iterator<FieldEntry> iter = fieldList.iterator(); FieldEntry fieldEntry; while (iter.hasNext()) { fieldEntry = iter.next(); //not print a value of each field //System.out.println("Fid: " + fieldEntry.fieldId() + " Name: " + fieldEntry.name() + " value: " + fieldEntry.load()); //apply() call for any RMTES field which is not blank if(fieldEntry.loadType()==DataTypes.RMTES & fieldEntry.code()!=Data.DataCode.BLANK) { //if the field id does not exist in the map, create new RmtesBuffer object if(!rmtesMap.containsKey(fieldEntry.fieldId())) { rmtesMap.put(fieldEntry.fieldId(), EmaFactory.createRmtesBuffer()); } //call apply() to interpret the intra-field position rmtesMap.get(fieldEntry.fieldId()).apply(fieldEntry.rmtes()); } } //prints all RMTES fields(the field id with its value) in the map on the console to display the page for (Integer fieldId: rmtesMap.keySet()) { System.out.print(fieldId+":"); System.out.println(rmtesMap.get(fieldId).toString()); } }…}
@Pimchaya, Thank you for the explanation. My requirement is to snapshot the page once / twice a day and the page does not update frequently. Can you share examples (RFA also ok) to extract data given the start & end position? Thanks.
@Pimchaya, Thank you for the information. I will look into the sample programs as you suggested.
Regards