Re: [Quickfix-developers] Make operation synchronize
Brought to you by:
orenmnero
From: Gunnar H. <gh...@hi...> - 2010-11-29 08:02:21
|
Hi, If I understand correctly you want to turn async. calls to server into sync. calls. Simplest way is to send your message and then start spinning/looping with a small sleep(x) and testing in body of your spinning loop if there is already a return on your sent message and once it is to send your 2nd message etc. If you don't want or cannot to wait for the response in the same thread from which you sent the message you can use a Queue object and put the messages that you want to send in that queue. The messages will come out of the queue one by one on it's own thread. From that thread you then send your messages and do the for-loop to wait for the response. There's probably more ways but this seems simplest to me. Gunnar On Nov 27, 2010, at 10:54 PM, alon ashkenazi wrote: > QuickFIX Documentation: http://www.quickfixengine.org/quickfix/doc/html/index.html > QuickFIX Support: http://www.quickfixengine.org/services.html > > Hi, > > Using Quick Fix engine I trying to synchronize some engine messages. > > I have a flow that operate a number of action on the account (send a number of message to the server). I want to synchronize between those messages, so they will start sequential. > > For example, I want to ask for 'CollateralInquiry' (BB) and wait for response. When the 'CollateralInquiryAck' (BG) receive, I will move to the next operation, send a 'NewOrderSingle' (D) for instance. > > The catch is that I don't want to write a spaghetti code (with callback like 'onMessage' on each operation). The ideal is to wait for operation to finish and then start the second one. > > Using c#, I tried to sync some operation with 'WaitHandle.WaitOne()' unsuccessfully. > > Any ideas? > Thanks, > Alon. > ------------------------------------------------------------------------------ > Increase Visibility of Your 3D Game App & Earn a Chance To Win $500! > Tap into the largest installed PC base & get more eyes on your game by > optimizing for Intel(R) Graphics Technology. Get started today with the > Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs. > http://p.sf.net/sfu/intelisp-dev2dev_______________________________________________ > Quickfix-developers mailing list > Qui...@li... > https://lists.sourceforge.net/lists/listinfo/quickfix-developers |