question

Upvotes
Accepted
87 4 4 11

How to judge Msg(StatusMsg. UpdateMsg. RefreshMsg) is codeChain or quotation

Hi:

I request the codeChain and stock in one process;

When i get Msg in onRefreshMsg or onUpdateMsg, How i can decide the msg is codeChain or quotation?

thanks

elektronrefinitiv-realtimeelektron-sdkrrtema-apielektron-message-api
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.

where is the Accept text,tks

Upvotes
Accepted
9.5k 10 5 7

Hello @luxiangyuan

Another way is to set closure in OmmConsumer.registerClient(ReqMsg reqMsg,OmmConsumerClient client,java.lang.Object closure) method when the application subscribes a RIC. closure parameter is used to specify application-defined item identification. Hence, in onRefreshMsg(..) or onUpdateMsg(..), you can check OmmConsumerEvent's closure if it is for which RICs or group of RICs(codeChain or quotation) before decoding data.

For example:

//for codeChain RIC 

consumer.registerClient( EmaFactory.createReqMsg().serviceName("ELEKTRON").name("0#.DJI"), appClient, "codeChain"); 


//for quotation RIC 

consumer.registerClient( EmaFactory.createReqMsg().serviceName("ELEKTRON").name("JPY="), appClient, "quotation"); 

and in onRefreshMsg(..) , onUpdateMsg(..)

public void onRefreshMsg(RefreshMsg refreshMsg, OmmConsumerEvent event) 
{ 
  if(event.closure().toString().equalsIgnoreCase("codeChain")) 
  { 
    System.out.println("process codeChain"); 
    .... 
  } 
  else if(event.closure().toString().equalsIgnoreCase("quotation")) 
  { 
    System.out.println("process quotation"); 
    ... 
  } 
}

The example result:

When the application receives data of codeChain

When the application receives data of quotation


codechain.png (36.2 KiB)
quotation.png (30.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.

Upvotes
9.5k 10 5 7

Hello @luxiangyuan

You can check if a message is codeChain or quotation by checking field id 239(REF_COUNT). Each codeChain message contains this field. If the message does not have the field, it is quotation. This is explained in How to tell if a RIC is for a chain? section of Simple Chain objects for EMA - Part 1

Hope this help.

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.

Upvotes
87 4 4 11

hello Pimchaya.Wongrukun

thanks for your answer.

as your answer, I must decode the FieldList to check if it contain the fileld id 239,

which is inefficient to me;

so I wan to know how i can judge the msg tpye before decode the FieldList, so I can

decode the codeChain or the quotation separately.

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.

Upvotes
87 4 4 11

hi Pimchaya.Wongrukun

thank you very much, i will try it,

thank you again.

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.

Upvotes
87 4 4 11

hello Alex Putkov:

I am so sorry , as I busied my self on "Decoding the info" received from EMA. i did not noticed the mail.

but i can not find the "Accept" text to click on this page. could you pleas gaves more details?

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.

Hi @luxiangyuan
We have already accepted the response that we thought best answers your question. If you're happy with this response you don't need to do anything. If you think another response on this thread provides a better answer, you can unaccept the response currently marked as Best Answer and accept another response. And if none of the replies on this thread provide the answer you were looking for, then please unaccept the Best Answer and post again on this thread, or start a new thread.

Hi Alex

Thank you very much, I understand.

I am a new developer and do not skilled with this web site, I am so sorry get you into trouble.

for the future, i will follow your suggestion

Click below to post an Idea Post Idea