[rabbitmq-discuss] Fwd: Messages not consistently delivered to two consumers bound to same key

Jeremy Dunck jdunck at gmail.com
Fri Jan 15 14:16:02 GMT 2010


Forwarded from the address I subscribed to the list with. :-/

Begin forwarded message:

> From: Jeremy Dunck <jeremy at radiotime.com>
> Date: January 14, 2010 11:42:25 PM CST
> To: rabbitmq-discuss at lists.rabbitmq.com
> Cc: Thomas Hutchings <thomas at radiotime.com>
> Subject: Messages not consistently delivered to two consumers bound  
> to same key
>

> I'm using Rabbit 1.7.0 w/ the .Net client.
>
> I am publishing messages with a routing key, say "A", and two queues
> bound to that routing key on a Direct exchange:
> _mqChannel.ExchangeDeclare(SHARED_EXCHANGE, ExchangeType.Direct,  
> NOT_DURABLE);
>
> (I've aliased the various boolean flags as variables so I can more
> easily maintain the code; I fnd a series of true/false literals pretty
> hard to remember.)
>
> I then have a basic consumer on each of the queues dispatching.
>
> It seems that messages published to A are being alternately delivered
> to the two queues, rather than consistently to both queues.
>
> Here's how I'm declaring and binding the queues (in separate  
> processes):
> _mqChannel.QueueDeclare(_busId, NOT_PASSIVE, NOT_DURABLE,
> NOT_EXCLUSIVE, AUTODELETE, WAIT, new Hashtable());
> _mqChannel.QueueBind(_busId, SHARED_EXCHANGE, "A", WAIT, null);
>
> I then have a basic consumer on each of the queues:
> var consumer = new QueueingBasicConsumer(_mqChannel);
> _mqChannel.BasicConsume(_busId, null, consumer);
> e = (BasicDeliverEventArgs)consumer.Queue.Dequeue();
> ...
> If it matters, I'm acknowledging messages is *both* consumers as  
> follows:
>
> _mqChannel.BasicAck(e.DeliveryTag, false);
>
>
> And here's how I'm publishing:
> _mqChannel.BasicPublish(SHARED_EXCHANGE, "A", MANDATORY,
> NOT_IMMEDIATE, props, <bytes>);
>
> I was wondering what might cause this behavior?
>
> While I'm here, are there any semantics to DeliveryTag?  It appears to
> be a sequentially-incrementing number, but it's not for all messages
> published -- is it per consumer?
>
> Just when I think I've got the hang of Rabbit, I find I'm still on
> shaky ground.  :-/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20100115/5f5d7cb3/attachment.htm 


More information about the rabbitmq-discuss mailing list