Waiting for a response with stompest.async

86 views
Skip to first unread message

Dave Quigley

unread,
Jul 16, 2014, 1:48:36 PM7/16/14
to stom...@googlegroups.com
I am making a cli application with stompest and I have the cli code running in a separate twisted reactor thread. When I process a command I have it use the async.client.send method to send off my jms message. I am trying to find a way to get the cli to block until I receive a response to that jms message. I have the send function abstracted out and I was hoping to do a yield or a wait on a condition in that function. In my subscription handler for the response channel I was going to clear that condition and let the send function continue through which in turn lets the command handler return and move on. I can't seem to find anything in the twisted or stompest documentation which would allow me to do that. Is there something specific I should be using from twisted or stompest or should I look for standard python threading calls to perform the wait.

nikipore

unread,
Jul 16, 2014, 4:29:27 PM7/16/14
to stom...@googlegroups.com
You definitely do not need anything like threading calls. The relevant primitives are there in both twisted and stompest. But I haven't fully grasped what you are about to do. Probably you'll have to do something along these lines inside an inlineCallbacks wrapper:

1. subscribe a callback
2. send
3. yield the callback
4. (reply arrives)
5. unsubscribe

When you have that running, you can make some generic wrapper out of these steps.

If this hasn't helped you, would you please jot down what should happen on the STOMP protocol level? And what should happen on the API level and what on the CLI level in your application? Then I am quite sure I will be able to help you.
Reply all
Reply to author
Forward
0 new messages