[rabbitmq-discuss] SimpleAmqpClient Channel usage

Alan Antonuk alan.antonuk at gmail.com
Thu Mar 13 04:48:26 GMT 2014


If I understand your scenario correctly: you want to create
consumers/queues/bindings, while blocking waiting for a message using
BasicConsumeMessage().

Unfortunately SimpleAmqpClient and the rabbitmq-c library it wraps are
single threaded, and don't support this use-case well. You have one of two
options:

- Create a new SimpleAmqpClient Channel object for each consumer. (Note
that a SimpleAmqpClient Channel object wraps an entire AMQP connection, and
manages AMQP channels internally, yes this was a poorly named).
- Use the timeout parameter on BasicConsumeMessage, and occasionally poll
for a new consumers and create the consumers/queues/bindings as necessary.
- Depending on how your application is setup there's probably a third way.

-Alan



On Wed, Mar 12, 2014 at 11:19 AM, pkbasu <pk_basu at hotmail.com> wrote:

> Greetings,
>
> here is the flow of my program -
>
> 1. Create a SimpleAmqpClient channel
> 2. Consumer1 comes and created queues and bindings.
> 3. BasicConsumeMessage is called on the channel, the one which consumes
> message for any open consumers
> 4. We are waiting now for any message to come in.
> 5. Consumer2 comes and tries to create queue and bindings.
> 6. Consumer2 hangs since the channel is busy in step 4
>
> How do I make this work? Creating a separate channel for creating queues
> and
> bindings will not work since BasicConsumeMessage works only on consumers
> created by its own channel.
>
>



> Any help is greatly appreciated.
>
> Thanks.
>
>
>
> --
> View this message in context:
> http://rabbitmq.1065348.n5.nabble.com/SimpleAmqpClient-Channel-usage-tp34067.html
> Sent from the RabbitMQ mailing list archive at Nabble.com.
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140312/e9138893/attachment.html>


More information about the rabbitmq-discuss mailing list