New posts are disabled while we improve the user experience.

You can browse the site, or for urgent issues, raise a query at MyAccount.

question

Upvotes
Accepted
1 0 0 2

RFAJ api to get multiple snap data with single session

Hi Team, Greetings for the day, We are using a RFAJ api to get the marketdata to one of our customer. We have already existing component to get the various type of market data from the service.But client raised an issue like every time appication was opening a session and capturing the data and cleanup call. So IT team raising that it was expensive calls from their network it seems. So they asked to change the polling logic like application need to open a session and capture the data after that also system has to use the same session and capture the latest image data. We need reuters help on this how to capture the data with one session to get data multiple times during the day. Please share your expertise inputs so that we will build the to fulfill the client needs.

treprfarfa-api
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.

Upvotes
Accepted
25.4k 90 13 26

Hi @madhavareddy.bollu

To make multiple Snap requests using the same session is relatively straight forward.

The application needs to perform the initial steps such as loading config, creating session,login, dictionary etc one at the startup.

You then send an snapshot request as and when you wish to do so.

In the meantime you should continue dispatching events throughout the duration of the program, in case there are events your application needs to be made aware of and process e.g. connection events, login related events such as logged out or service level events such as service down / up.

If you have not already done so, please refer to the RFA Java tutorial which should provide a good understanding of how RFA API can be used. In Step 8, it is SendRequest method which makes the data item request - so you would use some similar code (with changes for SnapShot mode) each time you want to make a request.

When you make a SnapShot request, the API closes the item stream etc once it has delivered the RefreshMsg - so there would be no need to call unregisterClient for your SnapShot once the data has been received,

The un-initialisation code, and cleanup code etc should only be called when the application exits.

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.

Upvotes
9.6k 10 7 7

Hello @madhavareddy.bollu

To capture multiple data with one session (OMM interface) logging in by one user during the day, the application can send an item request with the streaming mode just one time. Then, the application gets the following the item data messages:

  1. Refresh (Initial image) message which is the first response. The message contains all the possible fields for the requested item. The application should keep this as the initial image data.
  2. Update messages contain the fields that have changed since the last message the application receives. Hence, the application can get data (latest) multiple times during the day in Update messages. To maintain the latest image data, after receiving an Update message, the application should update the image data with the fields'value in the update message.

To request an item data with the streaming mode, set the indication flag of the item request message to REFRESH without NONSTREAMING. For example:

msg.setIndicationFlags(OMMMsg.Indication.REFRESH);

After the application requests an item with the streaming mode, it continues receiving data until it invokes OMMConsumer.unregisterClient(Handle). Then, the item stream is closed and the application will not receive data any more. The method should be called when the application cleans up or does not need any data of an item. Note: Handle is a handle of the item returned by OMMConsumer.registerClient(..) called to request the item.

The example of update message when requesting an item with the streaming mode:

You can notice that there is no any item name shown in the update message above. If the session requests one item, there is no problem.

If the session requests more than one item, ATTRIB_INFO_IN_UPDATES indication flag should be set in each request item. For example:

ommmsg.setIndicationFlags(OMMMsg.Indication.REFRESH
| OMMMsg.Indication.ATTRIB_INFO_IN_UPDATES);

This makes each update message contains the item name. Hence, you can know if an update message is for which item. For example:

For the complete application source code and more details, please refer to Tutorial 8 - Retrieving Level 1 MARKET PRICE Data


updatenoricname.png (31.3 KiB)
updatericname.png (46.6 KiB)
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.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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