[rabbitmq-discuss] queue architecture
Alexandru Scvortov
alexandru at rabbitmq.com
Thu Oct 28 22:27:55 BST 2010
> I have a scenario where I'd like to get a message from a queue and do some
> validations and decide if it needs processing , if not then put it back in
> the queue for a later time.
>
> Whats the best way to accomplish this.. Can I just get the message not and
> not call baskcAck if I don't need to process it ? Not calling basicAck puts
> the message back on teh queue after a while ?
Something like that. When a message is delivered, it is taken off the queue
but not deleted. If you close the channel without ack'ing the message,
it gets re-inserted into the queue.
So, the message will get requeued when you close the channel but not
before.
An alternative is basic.reject:
http://www.rabbitmq.com/blog/2010/08/03/well-ill-let-you-go-basicreject-in-rabbitmq/
Basically, basic.reject{requeue=true} is exactly what you want. It's a
way for a consumer to refuse a message from the broker.
> Currently I have a working solution where I get the message, deserialize it
> and then put the message back again into the queue. Is there a better way ?
That would also work.
Cheers,
Alex
On Thu, Oct 28, 2010 at 02:05:34PM -0700, Reefee wrote:
>
> I am using the Java Client
>
> I have a scenario where I'd like to get a message from a queue and do some
> validations and decide if it needs processing , if not then put it back in
> the queue for a later time.
>
> Whats the best way to accomplish this.. Can I just get the message not and
> not call baskcAck if I don't need to process it ? Not calling basicAck puts
> the message back on teh queue after a while ?
>
> Currently I have a working solution where I get the message, deserialize it
> and then put the message back again into the queue. Is there a better way ?
>
> --
> View this message in context: http://old.nabble.com/queue-architecture-tp30079644p30079644.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