question

Upvotes
Accepted
7 2 1 4

EMA Batchview: Getting data for fields in updates that I did not specify

I am using the BatchView to get only few fields of interest for Quotes/Trades. I followed the example as mentioned in this code sample. However, I see that the updates contain fields apart from the fields that I registered in my batchview. When such a behavior will be observed? I am interested only in few fields not all.

val batchView = createElementList()
batchView.add(createElementEntry().array(EmaRdm.ENAME_BATCH_ITEM_LIST, symbolList))
batchView.add(createElementEntry().uintValue(EmaRdm.ENAME_VIEW_TYPE, 1))
batchView.add(createElementEntry().array(EmaRdm.ENAME_VIEW_DATA, fieldIds))
batchView
elektronrefinitiv-realtimeelektron-sdkrrtema-apielektron-message-apibatchjava-8
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.

Upvote
Accepted
45.2k 103 43 60

@purvesh.yadav

You can also enable XML tracing in EMA Java to verify if the connected server supports batch or view requests.

To enable XML tracing, you need to set XmlTraceToStdout to 1 on the active or default consumer.

<ConsumerGroup>
    <!-- DefaultConsumer parameter defines which consumer configuration is used by OmmConsumer            -->
    <!-- if application does not specify it through OmmConsumerConfig::consumerName()                    -->
    <!-- first consumer on the ConsumerList is a DefaultConsumer if this parameter is not specified        -->
    <DefaultConsumer value="Consumer_1"/>
    <ConsumerList>
        <Consumer>
            <!-- Name is mandatory                                                                        -->
            <Name value="Consumer_1"/>

            <!-- Channel is optional: defaulted to "RSSL_SOCKET + localhost + 14002"                    -->
            <!-- Channel or ChannelSet may be specified                                                    -->
            <Channel value="Channel_1"/>

            <!-- Dictionary is optional: defaulted to "ChannelDictionary"                                -->
            <Dictionary value="Dictionary_1"/>
            <XmlTraceToStdout value="1"/>
        </Consumer>

After running the application, you will see the XML trace on the standard out. Then, verify the SupportBatchRequests and SupportViewRequests attributes in the login refresh message.

<REFRESH domainType="LOGIN" streamId="1" containerType="NO_DATA" flags="0x168 (HAS_MSG_KEY|SOLICITED|REFRESH_COMPLETE|CLEAR_CACHE)" groupId="0" State: Open/Ok/None - text: "Login accepted by host flix." dataSize="0">
    <key flags="0x26 (HAS_NAME|HAS_NAME_TYPE|HAS_ATTRIB)" name="user" nameType="1" attribContainerType="ELEMENT_LIST">
        <attrib>
            <elementList flags="0x08 (HAS_STANDARD_DATA)">
                <elementEntry name="AllowSuspectData" dataType="UINT" data="1"/>
                <elementEntry name="ApplicationId" dataType="ASCII_STRING" data="256"/>
                <elementEntry name="ApplicationName" dataType="ASCII_STRING" data="ADS"/>
                <elementEntry name="Position" dataType="ASCII_STRING" data="172.17.204.33/U8009686-TPL-A"/>
                <elementEntry name="ProvidePermissionExpressions" dataType="UINT" data="1"/>
                <elementEntry name="ProvidePermissionProfile" dataType="UINT" data="0"/>
                <elementEntry name="SingleOpen" dataType="UINT" data="1"/>
                <elementEntry name="SupportOMMPost" dataType="UINT" data="1"/>
                <elementEntry name="SupportPauseResume" dataType="UINT" data="1"/>
                <elementEntry name="SupportStandby" dataType="UINT" data="0"/>
                <elementEntry name="SupportBatchRequests" dataType="UINT" data="1"/>
                <elementEntry name="SupportViewRequests" dataType="UINT" data="1"/>
                <elementEntry name="SupportOptimizedPauseResume" dataType="UINT" data="1"/>
            </elementList>
        </attrib>
    </key>
    <dataBody>
    </dataBody>
</REFRESH>


If the values of SupportViewRequests and SupportBatchRequests are 0, you need to verify license or settings on the server.



1580701570821.png (41.1 KiB)
1580701613943.png (32.5 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.

Added the code. Since, the response is so big, so I have to add it as a comment.

Please look at Wasin's reply. The list of fields that one is adding in the RequestMsg must not be repeated otherwise the API will send full response not just the requested fields.

Upvotes
11.7k 57 39 60

Hi @purvesh.yadav,

Such behavior will be observed if your server (ADS) does not support or has enabled the batch or View capability. I assume when you request for the data every field is being returned? Does the batch work?

As a simple test, try the View example referenced in the link you provided above, i.e.

  • example360__MarketPrice__View

If this works, please post your entire code segment so someone can try it out.


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.

I enabled the XML trace and it seems that I have the Batch+View support enabled. I have added the code that I have modified to serve my purpose. I am still getting some fields that I have not subscribed.

Upvote
9.5k 10 5 7

Hello @purvesh.yadav

To enable Dynamic View on ADS version 2.x, ADS that the application connects to must be installed with the required license, SNAP_AND_DYNAMIC_VIEW license key. Otherwise, the application will get all fields available to the item it requests with View. Please contact Refinitiv account team to obtain the license. If the application connects to ADS version 3.x, the license is embedded in ADS already. Hence, there should be nothing done in the ADS(server side).

For the example source code, you can refer to the article, Elektron Messaging API (Java) - Batch and View features

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
7 2 1 4

Thanks for the response. I am getting the following response after enabling the XMLTrace.

<REFRESH domainType="LOGIN" streamId="1" containerType="NO_DATA" flags="0x168 (HAS_MSG_KEY|SOLICITED|REFRESH_COMPLETE|CLEAR_CACHE)" dataSize="0">
    <key flags="0x26 (HAS_NAME|HAS_NAME_TYPE|HAS_ATTRIB)"nameType="1" attribContainerType="ELEMENT_LIST">
        <attrib>
            <elementList flags="0x08 (HAS_STANDARD_DATA)">
                <elementEntry name="AllowSuspectData" dataType="UINT" data="1"/>
                <elementEntry name="ApplicationId" dataType="ASCII_STRING" data="636"/>
                <elementEntry name="ApplicationName" dataType="ASCII_STRING" data="ADS"/>
                <elementEntry name="Position" dataType="ASCII_STRING" data="10.144.255.113"/>
                <elementEntry name="ProvidePermissionExpressions" dataType="UINT" data="1"/>
                <elementEntry name="ProvidePermissionProfile" dataType="UINT" data="0"/>
                <elementEntry name="SingleOpen" dataType="UINT" data="1"/>
                <elementEntry name="SupportEnhancedSymbolList" dataType="UINT" data="1"/>
                <elementEntry name="SupportOMMPost" dataType="UINT" data="1"/>
                <elementEntry name="SupportPauseResume" dataType="UINT" data="1"/>
                <elementEntry name="SupportStandby" dataType="UINT" data="1"/>
                <elementEntry name="SupportBatchRequests" dataType="UINT" data="7"/>
                <elementEntry name="SupportViewRequests" dataType="UINT" data="1"/>
                <elementEntry name="SupportOptimizedPauseResume" dataType="UINT" data="1"/>
            </elementList>
        </attrib>
    </key>
    <dataBody>
    </dataBody>
</REFRESH>

So, it seems that I have the ability to make Batch requests. I modified example36o to make batch requests like this.

AppClient appClient = new AppClient();
consumer  = EmaFactory.createOmmConsumer(
  EmaFactory.createOmmConsumerConfig("./config/reuters/EmaConfig.xml")
             .host("<some-host>")
             .username("user")
             .applicationId("apppId")
);

ElementList view = EmaFactory.createElementList();
OmmArray batch = EmaFactory.createOmmArray();
batch.add(EmaFactory.createOmmArrayEntry().ascii("NQc1"));
batch.add(EmaFactory.createOmmArrayEntry().ascii("ESc1"));
OmmArray array = EmaFactory.createOmmArray();

array.fixedWidth(2);
array.add(EmaFactory.createOmmArrayEntry().intValue(22)); // BID
array.add(EmaFactory.createOmmArrayEntry().intValue(30)); // BIDSIZE
array.add(EmaFactory.createOmmArrayEntry().intValue(25)); // ASK
array.add(EmaFactory.createOmmArrayEntry().intValue(31)); // ASKSIZE
array.add(EmaFactory.createOmmArrayEntry().intValue(8927)); // INST_PHASE
array.add(EmaFactory.createOmmArrayEntry().intValue(8927)); // MIC_CODE
array.add(EmaFactory.createOmmArrayEntry().intValue(3855)); // QUOTIM_MS,
array.add(EmaFactory.createOmmArrayEntry().intValue(1025)); // QUOTIM,
array.add(EmaFactory.createOmmArrayEntry().intValue(1709)); // RDN_EXCHD2
array.add(EmaFactory.createOmmArrayEntry().intValue(1021)); // SEQNUM,
array.add(EmaFactory.createOmmArrayEntry().intValue(5)); // TIMACT,
array.add(EmaFactory.createOmmArrayEntry().intValue(14269)); // TIMACT_NS,

view.add(EmaFactory.createElementEntry().array(EmaRdm.ENAME_BATCH_ITEM_LIST, batch));
view.add(EmaFactory.createElementEntry().uintValue(EmaRdm.ENAME_VIEW_TYPE, 1));
view.add(EmaFactory.createElementEntry().array(EmaRdm.ENAME_VIEW_DATA, array));

consumer.registerClient(EmaFactory.createReqMsg().serviceName("IDN_SELECTFEED").payload(view), appClient);

Thread.sleep(60000);   // API calls onRefreshMsg(), onUpdateMsg() and onStatusMsg()

And here is the one of the update response. As you can see that I have not subscribed for PRC_QL_CD, MKT_ST_IND but I still get the data.

UpdateMsg
    streamId="6"
    domain="MarketPrice Domain"
    updateTypeNum="1"
    name="NQc1"
    serviceId="23"
    serviceName="IDN_SELECTFEED"
    Payload dataType="FieldList"
        FieldList
            FieldEntry fid="25" name="ASK" dataType="Real" value="9120.75"
            FieldEntry fid="31" name="ASKSIZE" dataType="Real" value="4.0"
            FieldEntry fid="3855" name="QUOTIM_MS" dataType="UInt" value="67432388"
            FieldEntry fid="3516" name="ASK_TIME1" dataType="Time" value="18:43:52:000:000:000"
            FieldEntry fid="4147" name="ASK_TIM_MS" dataType="UInt" value="67432388"
            FieldEntry fid="6580" name="ASK_COND_N" dataType="Rmtes" value="1"
            FieldEntry fid="6554" name="NO_ASKORD1" dataType="UInt" value="4"
            FieldEntry fid="1697" name="SPARE_TS1" dataType="Time" value="18:43:52:000:000:000"
            FieldEntry fid="118" name="PRC_QL_CD" dataType="Enum" value="160"
            FieldEntry fid="133" name="MKT_ST_IND" dataType="Enum" value="16"
            FieldEntry fid="1021" name="SEQNUM" dataType="Real" value="3.0996721E7"
            FieldEntry fid="3887" name="SEQNUM_QT" dataType="Real" value="3.0996721E7"
        FieldListEnd
    PayloadEnd
UpdateMsgEnd
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.

Is this the expected behavior? I am expecting that I should not get more than what I subscribed for.

@purvesh.yadav

Can you share the full XML trace file? We can verify the items' requests and responses from the trace file.

I have attached the trace file with the information.

Upvote
14.3k 23 8 12

Hello @purvesh.yadav

I can replicate the issue with your given source code. ADS returns all fields data in refresh message to the API.

I found that you have requested a duplicate 8927 FID in the View OMMArray.

array.add(EmaFactory.createOmmArrayEntry().intValue(8927)); // INST_PHASE
array.add(EmaFactory.createOmmArrayEntry().intValue(8927)); // MIC_CODE

After I changed the MIC_CODE_D Field ID , the API receives only requested FIDs from ADS successfully.

array.add(EmaFactory.createOmmArrayEntry().intValue(8927)); // INST_PHASE
array.add(EmaFactory.createOmmArrayEntry().intValue(11662)); // MIC_CODE_D

Please see my trace file here: example380_Batch_View.zip


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.

Thanks a lot. After removing the duplicate, I am too seeing the expected result. I believe this is not an expected behavior and it is difficult to catch such an error unless documented or validated through an API. I maintain separate list of fields for Quotes/trades and I aggregate them before forming the batch. Seqnum exists in both the places, therefore, resulted in duplicate.

Hi @purvesh.yadav

Please be informed that I have submitted this behavior as issue 131 in Elektron SDK GitHub page.