Erlang Mailing Lists

Author Message

<  RabbitMQ mailing list  ~  how to consume one message at a time

Guest
Posted: Thu Nov 19, 2009 11:08 pm Reply with quote
Guest
I'm not sure what the .NET api looks like, but you want to do a basic get, rather then a basic subscribe.

It will return a single message from the queue, and then when you call it again, you will get the next message(or null/something similar)

Scott

On 2009-11-16, at 5:41 PM, JD Conley wrote:

> I'm using the .NET client and can't figure out how to consume only one
> message at a time. Basically I would like to simply:
>
> 1. Consume one message from a queue
> 2. Cancel consumption so I don't lose any messages
>
> My confusion comes with the statement in the user guide that "Application
> callback handlers must not invoke blocking AMQP operations (such as
> IModel.QueueDeclare or IModel.BasicCancel). If they do, the channel will
> deadlock." But, a BasicCancel is precisely what I want to do in the
> callback.
>
> I want to use the EventingBasicConsumer. What would be the best way to
> accomplish this? Which options do I set?
>
> -JD
>
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss@lists.rabbitmq.com
> http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss


_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss@lists.rabbitmq.com
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Post received from mailinglist
Guest
Posted: Fri Nov 20, 2009 12:38 am Reply with quote
Guest
On Mon, Nov 16, 2009 at 08:59:35PM -0600, Scott Brooks wrote:
> I'm not sure what the .NET api looks like, but you want to do a basic get, rather then a basic subscribe.
>
> It will return a single message from the queue, and then when you call it again, you will get the next message(or null/something similar)

Yup, that'll work. Or set QoS to 1 and use subscribe and then you'll
only get the next msg when you ack the previous one.

Matthew

_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss@lists.rabbitmq.com
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Post received from mailinglist
Guest
Posted: Fri Nov 20, 2009 12:38 am Reply with quote
Guest
Thanks Scott. But I do want to subscribe/consume (I think), as it is unknown whether there will be any data in the queue, and I want to be notified immediately when there is. I don't really want to poll rabbit using a basic.get and would rather be notified asynchronously when new items are in the queue. I have hundreds (thousands soon) of queues waiting for data across a cluster and the polling overhead would be higher than I want it to be.

-JD
----- Original Message -----
From: "Scott Brooks" <scott.brooks@epicadvertising.com>
To: "JD Conley" <jdc@hive7.com>
Cc: rabbitmq-discuss@lists.rabbitmq.com
Sent: Monday, November 16, 2009 6:59:35 PM GMT -08:00 US/Canada Pacific
Subject: Re: [rabbitmq-discuss] how to consume one message at a time

I'm not sure what the .NET api looks like, but you want to do a basic get, rather then a basic subscribe.

It will return a single message from the queue, and then when you call it again, you will get the next message(or null/something similar)

Scott

On 2009-11-16, at 5:41 PM, JD Conley wrote:

> I'm using the .NET client and can't figure out how to consume only one
> message at a time. Basically I would like to simply:
>
> 1. Consume one message from a queue
> 2. Cancel consumption so I don't lose any messages
>
> My confusion comes with the statement in the user guide that "Application
> callback handlers must not invoke blocking AMQP operations (such as
> IModel.QueueDeclare or IModel.BasicCancel). If they do, the channel will
> deadlock." But, a BasicCancel is precisely what I want to do in the
> callback.
>
> I want to use the EventingBasicConsumer. What would be the best way to
> accomplish this? Which options do I set?
>
> -JD
>
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss@lists.rabbitmq.com
> http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss





Post received from mailinglist
Guest
Posted: Fri Nov 20, 2009 12:38 am Reply with quote
Guest
Then adjusting the prefetch(part of basic.qos) is probably what you want.
Guest
Posted: Fri Nov 20, 2009 1:38 am Reply with quote
Guest
I'm using the .NET client and can't figure out how to consume only one
message at a time. Basically I would like to simply:

1. Consume one message from a queue
2. Cancel consumption so I don't lose any messages

My confusion comes with the statement in the user guide that "Application
callback handlers must not invoke blocking AMQP operations (such as
IModel.QueueDeclare or IModel.BasicCancel). If they do, the channel will
deadlock." But, a BasicCancel is precisely what I want to do in the
callback.

I want to use the EventingBasicConsumer. What would be the best way to
accomplish this? Which options do I set?

-JD


_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss@lists.rabbitmq.com
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Post received from mailinglist

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum