[rabbitmq-discuss] it correct way to creating consumer as an daemon thread?
Alexandru Scvorţov
alexandru at rabbitmq.com
Fri Feb 11 00:45:48 GMT 2011
Hi,
That would work. Alternatively, you could just subclass
QueueingConsumer or DefaultConsumer. Doing this would give you more
fine-grained control over the connection. For instance, if this is a
long running daemon, you should take into account connection failure, so
you'd need to override handleShutdownSignal. Also, unless you
basicConsume with autoAck enabled, don't forget to ack the deliveries.
> consumer that are infinite run and
> poll queue where message are arrives.
That's not polling. You could use basicGet instead of basicConsume.
*That* would be polling and it would be less efficient than consuming.
So, you're doing the right thing.
Cheers,
Alex
On Mon, Feb 07, 2011 at 08:15:25PM -0800, sam_mis wrote:
>
> Hi
>
> i am using Rabbitmq Java client library. consumer that are infinite run and
> poll queue where message are arrives.
>
>
> boolean runInfinite = true;
> while (runInfinite)
> {
> QueueingConsumer.Delivery task;
> try
> {
> task= consumer.nextDelivery();
> }
> catch (InterruptedException ie)
> {
> continue;
> }
> }
> consumer infinitely run i want to make it daemon thread.it is correct way to
> make it daemon thread and there are other option.
>
> Thanks
>
> --
> View this message in context: http://old.nabble.com/it-correct-way-to-creating-consumer-as-an-daemon-thread--tp30870170p30870170.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
More information about the rabbitmq-discuss
mailing list