How do I know when the dictionary refresh is complete?

When requesting a dictionary I can't tell when I've received all the messages. Currently I get 4 refresh messages with the field dictionary spread accross them. How can I tell in Elektron that I have no more messages pending? In RFA you can set completion events or check the connection state but I can't find the equivalent in Elektron.

Here's the request I send:

DictionaryClient dictionaryClient = new DictionaryClient();

long fieldHandle = consumer.registerClient(EmaFactory.createReqMsg()
.domainType(EmaRdm.MMT_DICTIONARY)
.name("RWFFld")
.serviceName("REPUB")
.initialImage(true)
.interestAfterRefresh(false) //SNAPSHOT
.filter(EmaRdm.DICTIONARY_NORMAL), dictionaryClient);

Best Answer

  • Hello @tbaker,

    Elektron-SDK1.1.0.java was released on the last Friday (April 28, 2017).

    I've tested it with the same scenario, it seems like the API can give a correct result now.

    // Register Items
    ReqMsg reqMsg = EmaFactory.createReqMsg();
    consumer.registerClient(reqMsg.clear().serviceName("myServiceName").name("RWFFld").domainType(DomainTypes.DICTIONARY).filter(7), appClient);
    consumer.registerClient(reqMsg.clear().serviceName("myServiceName").name("RWFEnum").domainType(DomainTypes.DICTIONARY).filter(7), appClient);
    consumer.registerClient(reqMsg.clear().serviceName("myServiceName").name("JPY=").domainType(DomainTypes.MARKET_PRICE), appClient);
    consumer.registerClient(reqMsg.clear().serviceName("myServiceName").name("BB.TO").domainType(DomainTypes.MARKET_BY_PRICE), appClient);

    // onRefreshMsg Callback Method
    public void onRefreshMsg(RefreshMsg refreshMsg, OmmConsumerEvent event)
    {
    System.out.println("refreshMsg.domainType(): " + DomainTypes.toString(refreshMsg.domainType()));
    System.out.println("refreshMsg.name(): " + refreshMsg.name());
    System.out.println("refreshMsg.complete(): " + refreshMsg.complete());
    }

    Here is the result:

    refreshMsg.domainType(): DICTIONARY
    refreshMsg.name(): RWFFld
    refreshMsg.complete(): true
    refreshMsg.domainType(): DICTIONARY
    refreshMsg.name(): RWFEnum
    refreshMsg.complete(): true
    refreshMsg.domainType(): MARKET_PRICE
    refreshMsg.name(): JPY=
    refreshMsg.complete(): true
    refreshMsg.domainType(): MARKET_BY_PRICE
    refreshMsg.name(): BB.TO
    refreshMsg.complete(): true

    To download the latest version of EMA Java, please access this link.

    Hope this helps!

Answers

  • Hi @tbaker

    You can determine if a refresh message is complete by using the complete() method on the refreshMsg object when receiving your response(s). Refer to the Multi-Part messages section within the EMA Consumer - Requesting, Parsing and decoding level 2 data tutorial as a guide.

  • Hi @tbaker,

    According to the reference manual in the Ema package, the following subclasses of Msg provide a complete() method for checking whether the current message object is a final part of all multi-parts or not.

    RefreshMsg - a complete() returns true if this is the last part of the multi part refresh message. 

    GenericMsg - a complete() returns true if this is a one part generic message or the final part of the multi part generic message.

    PostMsg - a complete() returns true if this is the last part of the multi part post message.

    Note that there are only three message types; Refresh, Generic, and Post that support message fragmentation. Therefore, message types other than above don't provide the complete() method.

    Hope this helps.

  • Thanks for the response. I am processing the RefreshMsg but complete() remains false. I end up getting 5 messages if I don't set the service name. All messages have the following Complete and State values:

    Complete: false, state: Open / Ok / None / ''

    Perhaps the dictionary messages aren't multipart but are just separate dictionary sections. Multipart is also set to false and there are no part numbers.

  • Hello @tbaker,

    I've also experienced the same issue when the Dictionary domain involved with the subscription. Therefore, I'll escalate this issue to the Development team.

  • Ok. thanks for raising. Is there any visibility on the issues raised with the development team? There's not a lot of activity on the github page and I don't know if there is a separate ticket tracking available on thomsonreuters.

  • @tbaker, I have an update regarding this issue. It will be fixed in the next maintenance release of Elektron SDK Java, yet I don't know the exact release date.

    I'll keep you posted when the new version is available.

  • Great. Many thanks for the help.

  • Please check my recent answer for the fix of this issue.

  • Hi Nipat,

    I've tested with 1.1.0 and the completion events do work now for dictionary requests. Thanks for helping!

    I found a different bug in 1.1.0 which I raised on github (https://github.com/thomsonreuters/Elektron-SDK/issues/26), so we can't move to the fix yet. We have a workaround that we can use until the next Elektron SDK is released.