Discover Refinitiv
MyRefinitiv Refinitiv Perspectives Careers
Created with Sketch.
All APIs Questions & Answers  Register |  Login
Ask a question
  • Questions
  • Tags
  • Badges
  • Unanswered
Search:
  • Home /
  • Elektron /
  • EMA /
avatar image
Question by luxiangyuan · Nov 23, 2018 at 10:10 PM · ema c++

[EMA C++] Can registerClient() & onRefreshMsg() run in different thread?

I develop with EMA C++,

I want to run registerClient()&onRefreshMsg() in different thread so that I can get all chains of HKSE,

shows as pic follows:

are there any methods?

c45a73cb7b0e58fc81c7a975466f06e.png (70.4 KiB)

People who like this

0 Show 0
Comment
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

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

5 Replies

  • Sort: 
avatar image
REFINITIV
Best Answer
Answer by umer.nalla · Nov 27, 2018 at 05:59 AM

Hi,

You can not store any EMA owned objects that you receive in the callbacks. As soon as the callback method returns the objects may be destroyed / reused etc by EMA.

You need to extract the field values and store them in application owned objects such as string, int etc. You can then spawn a different thread if required to process the stored values.

It is strongly advised that you minimise the amount of processing performed with the onRefresh / onUpdate callback handlers - since these are executing on the API thread.

As mentioned earlier, many EMA C++ developers consume several thousand instruments - without issues. This off course depends on how often your instruments update and just how CPU intensive your application level processing of the received data is. So I recommend you perform some tests, to see if the data update rates can be handled by your application on the API thread or if you need to spawn another thread to process your data.

Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

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

avatar image
REFINITIV
Answer by umer.nalla · Nov 26, 2018 at 05:50 AM

Hi @luxiangyuan

You don't need to make all your registerClient() calls from the main() method.

You can call registerClient / unregisterclient from API thread context in which your onRefresh or onUpdate callback methods are invoked - as and when you receive updates to the main chain in those callback methods.

So, when you receive for example the Refresh via the onRefresh and you start to decode & extract the other links in the chain, you can then call registerClient for those additional link.

Likewise, if the chain shrinks some of the chains / underlying RICs are removed from the chain, you can call unregisterClient for those items from the API thread context.

Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

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

avatar image
Answer by luxiangyuan · Nov 26, 2018 at 08:32 AM

How to invoke the callback methods "onRefresh " or "onUpdate " in new thread?

Is OmmConsumer support multiple thread?

Thank you.

Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

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

avatar image
REFINITIV
Answer by umer.nalla · Nov 26, 2018 at 09:39 AM

Hi @luxiangyuan

Not sure what you mean about using a new thread / why you want to use a new thread? You can make the registerClient call in the same API thread context on which the onRefreshMsg and onUpdateMsg callbacks are executed.

Many developers writing EMA Consumer applications often subscribe to several thousand instruments using a single OmmConsumer instance...

Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

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

avatar image
Answer by luxiangyuan · Nov 26, 2018 at 09:39 PM

hi

Now, I receive all the msg I requested in fun onRefreshMsg() or onUpdateMsg()

What I warried about is the "lowefficiency", because I must decode all the msg from HKSE and nasdaq to our struct in the main thread.

I want to store the msg received into a queue at the time onRefreshMsg() or onUpdateMsg() is invoked, then I can decode them with multiple threads but the constructor of refreshMsg and updateMsg is private, so I must decode all the refreshMsg and updateMsg to struct in the main thread, this is why I worried about the "lowefficiency".

Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

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

Watch this question

Add to watch list
Add to your watch list to receive emailed updates for this question. Too many emails? Change your settings >
7 People are following this question.

Related Questions

IProvider downloading dictionary and serviceName\serviceId parameter

[EMA C++]How to get seqNum in RefreshMsg and updateMsg

EMA Issue with update items

ESDK v er1.5.x for ERT In Cloud - Cpp/C build compilation error - Linker Errors

which fun should I use if I want to get "Spread Table"

  • Feedback
  • Copyright
  • Cookie Policy
  • Privacy Statement
  • Terms of Use
  • Careers
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Alpha
  • App Studio
  • Block Chain
  • Bot Platform
  • Calais
  • Connected Risk APIs
  • DSS
  • Data Fusion
  • Data Model Discovery
  • Datastream
  • Eikon COM
  • Eikon Data APIs
  • Elektron
    • EMA
    • ETA
    • WebSocket API
  • Legal One
  • Messenger Bot
  • Messenger Side by Side
  • ONESOURCE
    • Indirect Tax
  • Open PermID
    • Entity Search
  • Org ID
  • PAM
    • PAM - Logging
  • ProView
  • ProView Internal
  • Product Insight
  • Project Tracking
  • Refinitiv Data Platform
    • Refinitiv Data Platform Libraries
  • Rose's Space
  • Screening
    • Qual-ID API
    • Screening Deployed
    • Screening Online
    • World-Check One
    • World-Check One Zero Footprint
  • Side by Side Integration API
  • TR Knowledge Graph
  • TREP APIs
    • CAT
    • DACS Station
    • Open DACS
    • RFA
    • UPA
  • TREP Infrastructure
  • TRIT
  • TRKD
  • TRTH
  • Thomson One Smart
  • Transactions
    • REDI API
  • Velocity Analytics
  • Wealth Management Web Services
  • World-Check Data File
  • Explore
  • Tags
  • Questions
  • Badges