154 13 18 30

I need an example application using MarketData/TibMsg interface to parse page data

I cannot find any example application in RFA Java software package to parse page data e.g. RIC 3323bk.HKd.

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.

1 Answer

9.5k 10 5 7

Hello @Catherine Wong

The page data can be updated partially. Therefore, the application requires additional steps for processing an update message to display the correct data of the field.

Normally, updates to specific fields would be accomplished by sending the whole data field; however with some large fields this can be inefficient when only a few characters within the data field are to be updated. In such cases the publishing application sends an intra-field positioning sequence within the data field so that the minimum number of characters are transmitted to effect a change.

The syntax of an intra-field positioning sequence is as follows:



  • <CSI> is the control sequence introducer (this can be a one or two-byte sequence, either Hex 9B or Hex 1b 5b)
  • n is an ASCII numeric string representing the cursor offset position relative to the start of the field.
  • <HPA> is the Horizontal Position Adjust character which terminates the intra-field position sequence (Hex 60 which is an ASCII “ ‘ ”).

The 0x60 byte signals the termination of the partial update positioning sequence. n is a set of numeric digits (0x30 through 0x39) that represent the byte offset position relative to the start of the field. Counting begins with the first byte position being number 0 (zero).

For example, the application receives a refresh message with the field id 318 is:

 4087   -1s  4409  8578 |  3349  3268  8038  8738   

and the following hex update is received:

1b 5b 37 60 38 35 37 37 20 20 33 30 37 37 20 20 36 34 33

The update means update the field at position 7 with “8577 3077 643”

Then after the update is processed, the data of the field id 318 that the application should display is:

 4087  8577  3077  6438 |  3349  3268  8038  8738

The intra-field positioning sequence is supported for fields of the ALPHANUMERIC type.

TibMsg Interface used by MarketData applications provides the following class/constant that helps to interpret partial update:

  • TibMsg.TIBMSG_PARTIAL: Indicates data is partial field type containing offset and content(updated value). Use the class TibPartial for casting and dereference of this type of data.
  • TibPartial : provide methods to get offset(TibPartial.offset) and content(TibPartial.contents) in an partial update message.

Unfortunately, there is no MarketData example application shipped with RFA Java package to process partial updates. However, you can modify the file named in MDSubDemo application located in <RFAJ_Package>\Legacy\Examples\com\reuters\rfa\legacyexample\session\mdsub to use the class/constant above to process partial update.

The example source code of modified to process partial and full update is below:

public class MDSubDemoClient implements Client
    private final MDSubDemo _application;
    TibMsg msg = new TibMsg();
    TibField field = new TibField();
    //The map which keeps the fields(Field id & Value) to be updated
    Map<Integer,String> pageFields;
    public MDSubDemoClient(MDSubDemo subDemo)
        _application = subDemo;
        //initialize the map which keeps fields to be updated
        pageFields = new TreeMap<Integer,String>();
    protected void processMarketDataItemEvent(MarketDataItemEvent marketDataItemEvent)
      if (dict.fhint == Tib.HINT_MFEED_ENUMERATED)
        {  // if the field is not Enumerated type
         if( field.Type() == TibMsg.TIBMSG_PARTIAL ) 
         //update partial field
          TibPartial p = (TibPartial)field.Data();
          String updateStr = new String(p.contents);
          int offset = p.offset; //offset starts from 0
          System.out.println("fieldId:"+fid + ", offset:"+ offset + ", updateString:" + updateStr);
          StringBuilder value = new StringBuilder(pageFields.get(fid));
          value.replace(offset, offset+updateStr.length(), updateStr);
          pageFields.put(fid, value.toString());
         else {//update whole field
           pageFields.put(fid, field.StringData());
      //display the page after updating all fields of the page
      System.out.println("**********************Updated Page***************************************");
      for (Integer fieldId: pageFields.keySet()){

The example command line to run MDSubDemo 5 minutes(300 seconds) with a user named pimchaya to subscribe a RIC named 3323bk.HKd to the service named ELEKTRON_NEON on the server configured in a consumer session(connection type is SSL) named SSLNamespace::pageSSLSession:

java -cp .;..\..\Libs\rfa.jar com.reuters.rfa.legacyexample.session.mdsub.MDSubDemo -session SSLNamespace::pageSSLSession -serviceName ELEKTRON_NEON -itemName 3323bk.HKd -mounttpi true -user pimchaya -runTime 300

For the help of MDSubDemo, please refer to package.html in <RFAJ_Package>\Legacy\Examples\com\reuters\rfa\legacyexample\session\mdsub

The example output:

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.