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
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
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.
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.
hi Pimchaya.Wongrukun
thank you very much, i will try it,
thank you again.
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?
where is the Accept text,tks
Hi @luxiangyuanWe 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.