[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
Wed Sep 7 19:45:09 BST 2011


Only using one connection is the point of this modification.

I already have a setup that does an asynchronous call that instantiates a Pika Publisher to publish a message to the queue, and a Pika Monitor to consume messages. However those each create their own connection and ioloops.

Am I chasing my tail trying to get multiple channels created for a single connection? Then creating a queue on each channel, one to monitor, one to publish to?

Or is there some other more elegant solution to this? Looking to keep the number of connections to RabbitMQ down on a per application basis.


-Christopher Lefevre

From: Gavin M. Roy [mailto:gmr at myyearbook.com]
Sent: Wednesday, September 07, 2011 2:38 PM
To: Christopher Lefevre
Cc: Marek Majkowski; 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?

You can have multiple connections with one IO loop, assuming you're using PIka. In that case, the IOloop is a single instance across all connections, so you should setup both your connections before starting it, or use a timer to call a method after starting it that sets up your connections.

Gavin

On Wednesday, September 7, 2011 at 2:02 PM, Christopher Lefevre wrote:
EXACTLY!

That's the bit that I'm getting stuck on.

I have a publish method that sets up a connection, then calls another function to open a channel, then publishes to the queue as shown previously.

Within that function is a connection.ioloop.start() which I guess I don't really understand. For the individual publish/monitor functions they work as expected, the monitor will monitor and consume, while the publish only publishes once and breaks the ioloop, as expected.

To get an asynchronous Publish, then Monitor the reply_to queue, I can instantiate the classes for the monitor/publisher I have, and it will work with 2 connections to the server. However trying to get this done with one connection is where I'm balking.

-Christopher Lefevre


-----Original Message-----
From: Marek Majkowski [mailto:majek04 at gmail.com]
Sent: Wednesday, September 07, 2011 11:45 AM
To: Christopher Lefevre
Cc: rabbitmq-discuss at lists.rabbitmq.com<mailto: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 Wed, Sep 7, 2011 at 14:21, Christopher Lefevre
<CLefevre at transparent.com<mailto:CLefevre at transparent.com>> wrote:

Coming back to this after a day I realize throughout I was a bit off in describing my situation. I am actually attempting to get an asynchronous setup to work on one connection to the RabbitMQ server.

Connect, create a channel(s), publish to a queue, then monitor on the reply queue, in an asynchronous state, returning the reply to a web page when completed.

Well, if you want to use asynchronous style, than you need to have
an event loop and program using callbacks.

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.
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com<mailto:rabbitmq-discuss at lists.rabbitmq.com>
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20110907/c41f2f88/attachment.htm>


More information about the rabbitmq-discuss mailing list