[rabbitmq-discuss] Publish on a queue, then Monitor on a reply queue, with only 1 connection to the RabbitMQ server? Non-blocking?
Christopher Lefevre
CLefevre at Transparent.com
Tue Sep 6 18:46:02 BST 2011
We’re simply putting together a monitor that waits for a reply to be posted from a published item, so I would think that this should work out fine in that respect.
So the idea is to Publish => Wait for reply on the reply_to queue, close the connection.
Also thank you for the method explanation, reading up on the docs for that now.
-Christopher Lefevre
-----Original Message-----
From: Marek Majkowski [mailto:majek04 at gmail.com]
Sent: Tuesday, September 06, 2011 12:43 PM
To: Christopher Lefevre
Cc: Michael Klishin; rabbitmq-discuss at lists.rabbitmq.com
Subject: Re: [rabbitmq-discuss] Publish on a queue, then Monitor on a reply queue, with only 1 connection to the RabbitMQ server? Non-blocking?
On Tue, Sep 6, 2011 at 17:19, Christopher Lefevre
<CLefevre at transparent.com> wrote:
> To note, if this is an easier description, I’m trying to implement the RPC
> example on the RabbitMQ tutorial with a synchronous connection. Which I’ve
> copied below so you guys don’t need to go find it. However, the main impetus
> to me moving forward is lines 13/14:
>
> result = self.channel.queue_declare(exclusive=True)
>
> self.callback_queue = result.method.queue
Synchronous methods in AMQP return data. This data is captured
under 'result.method'.
result.method.queue contains a fresh, unique, exclusive queue name
that was just created.
> Line 13 declares the result variable as the product of the channel getting
> an exclusive queue created, which I get. However the part that I get caught
> up in is where the callback is set to result.method.queue in line 14. What
> exactly is the method.queue of the result object?
If you're interested in other fields under 'result.method' please take a look
at amqp spec, for example results of queue-declare are under queue-declare-ok
method: http://www.rabbitmq.com/amqp-0-9-1-reference.html#queue.declare-ok
> I am hoping to simply
> modify my Monitor/Publish classes to be able to have a synchronous
> publish/monitor without creating 2 connections. My current attempt at simply
> using one connection with 2 channels does not seem to be operating how I
> expected.
The problem is that RPC client does only listen for messages when
there is an RPC call running. So, you won't be able to get 'realtime'
data from other things that are hanging on the same connection.
You may hear the results only during the rpc call.
Cheers,
Marek
The information contained in this electronic message and any attached document(s) is intended only for the personal and confidential use of the designated recipients named above. This message may be confidential. If the reader of this message is not the intended recipient, you are hereby notified that you have received this document in error, and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify sender immediately by telephone (603) 262-6300 or by electronic mail immediately. Thank you.
More information about the rabbitmq-discuss
mailing list