ideas on implementing a priority queue?

58 views
Skip to first unread message

Adam Greene

unread,
Nov 21, 2009, 9:04:43 PM11/21/09
to AMQP
hey folks,

RabbitMQ doesn't support the priority flag, as defined by AMQP. Has
anyone tried to work around this with multiple priority queues wrapped
up into a single EM script?

Thanks,
Adam

Aman Gupta

unread,
Nov 21, 2009, 9:05:36 PM11/21/09
to ruby...@googlegroups.com
This approach should work, but make sure to create separate channels
for each queue you're subscribing to and set the prefetch on the
channels before subscribing.

Aman

>
> Thanks,
> Adam
>
> --
>
> You received this message because you are subscribed to the Google Groups "AMQP" group.
> To post to this group, send email to ruby...@googlegroups.com.
> To unsubscribe from this group, send email to ruby-amqp+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/ruby-amqp?hl=.
>
>
>

Joran Kikke

unread,
Jun 6, 2013, 6:38:32 AM6/6/13
to ruby...@googlegroups.com, adam....@gmail.com

Michael Klishin

unread,
Jun 6, 2013, 6:44:45 AM6/6/13
to ruby...@googlegroups.com

2013/6/6 Joran Kikke <jor...@gmail.com>

Prefetch does not control which channel has priority for deliveries. It controls how many messages
can be "in progress" (unacknowledged) on it.

This can be used as poor man's prioritization technique, however, you use automatic acknowledgement mode,
so prefetch does not come into play (RabbitMQ immediately considers your messages acknowledged
as soon as it sends them out).

I'd also point out that if you only publish a small number of messages and then your example finishes running,
it is much more likely that the ordering will depend greatly on the order you publish messages in.

To see the effect of the prefetch setting with manual acknowledgements, you'd need to run it for a longer period of time (which depends on your message rates, but say, at least a minute.
--
MK

http://github.com/michaelklishin
http://twitter.com/michaelklishin
Reply all
Reply to author
Forward
0 new messages