On 09/26/2013 12:03 AM, Mitsuru Oka wrote:
Another question on Dispatch router is there.
Could you show me an example of request-reply/response pattern via
Dispatch router using proton messenger based sender and receiver? I
tried proton client/server python example, but the client couldn't
receive reply message from server.
$ dispatch-router -c qpid-dispatch.conf
$ ./server.py amqp://0.0.0.0/topic
$ ./client.py amqp://0.0.0.0/topic subject
server output:
amqp://b0f56a1c-573c-42e0-8c6f-46d5735b2301/replies
Dispatched subject None
client output:
<nothing and blocking>
Thanks,
Mitsuru Oka
The request-reply pattern needs a bit of work. I'm putting a feature
into Dispatch that allows a client to dynamically obtain a routable
reply-to address. This will involve changes in Messenger as well.
In the mean time, you can make it work by doing the following:
First, modify your client line to include a reply-to address.
$ dispatch-router -c qpid-dispatch.conf
$ ./server.py amqp://0.0.0.0/topic
$ ./client.py -r amqp://0.0.0.0/reply amqp://0.0.0.0/topic subject
You will also need to apply the following patch to client.py. The reason
this patch is necessary is that the client/server example is written
only for the point-to-point case (no intermediary).
$ svn diff client.py
Index: client.py
===================================================================
--- client.py (revision 1520149)
+++ client.py (working copy)
@@ -41,15 +41,16 @@
msg.subject = subject
msg.reply_to = opts.reply_to
+mng.subscribe(opts.reply_to)
+
mng.put(msg)
mng.send()
-if opts.reply_to[:2] == "~/":
- mng.recv(1)
- try:
- mng.get(msg)
- print msg.address, msg.subject
- except Exception, e:
- print e
+mng.recv(1)
+try:
+ mng.get(msg)
+ print msg.address, msg.subject
+except Exception, e:
+ print e
mng.stop()
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@qpid.apache.org
For additional commands, e-mail: users-h...@qpid.apache.org