Hey, I am registering the symbol with one thread but processing is happening in another thread. In this case I dont get the closure back which is precisely the ItemName.
Hello @hamza.khalid,
Pass your closure as parameter into registerClient, per Developer Guide:
"... registerClient() on an OMM consumer or provider object. This method accepts
up to four parameters.
• The first parameter (pEventQueue) is a pointer to the event queue.
• The second parameter (ommItemIntSpec) is an interest specification.
• The third parameter (*this) is a client (i.e., the application callback that receives the dispatched events).
• The fourth parameter is a closure, which is a pointer to some opaque data supplied by the application. For more information about closures, refer to Section 6.4.1.6...."
Hope this helps, however, if you are getting started with RFA C++, would suggest to first work through RFA C++ Quickstart and RFA C++ Consumer Tutorials to save you time, effort and usually improving on the overall learning experience.
If this is a new app, consider designing and implementing it with our latest API Suite Elektron, EMA C++ API.
Hey,
I know how to use the API and the register client has 4 parameters I am sending closure as (void*) itemName. The problem is I am not receiving the closure back in the callback. Can you help me with that
Thanks
You are correct, the intention with setting of Closure is to be able to receive it with received Events. And making requests from one Thread while receiving in another should not be a problem.
Can think of two things that may be helpful:
Section "Event Distribution Usage Guidelines" of RFA Developers Guide discusses good practices, as well as what not to do. Perhaps worth reviewing, and maybe you can come up with what you are doing wrong.
The other is ConsPerf that can be found in PerfTools folder of RFA SDK, it may be a good example to review, this is a threaded example built to test and tune performance, and registerClient is called from one thread, while processRespMsg is in another. It passes Closure of itemName. As a sanity check, I have just added printing Closure to processRespMsg (in different thread) and I see the closure printed as expected.