<html><body bgcolor="#FFFFFF"><div>Forwarded from the address I subscribed to the list with. :-/</div><div><br>Begin forwarded message:<br><br></div><blockquote type="cite"><div><b>From:</b> Jeremy Dunck <<a href="mailto:jeremy@radiotime.com">jeremy@radiotime.com</a>><br><b>Date:</b> January 14, 2010 11:42:25 PM CST<br><b>To:</b> <a href="mailto:rabbitmq-discuss@lists.rabbitmq.com"><a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a></a><br><b>Cc:</b> Thomas Hutchings <<a href="mailto:thomas@radiotime.com">thomas@radiotime.com</a>><br><b>Subject:</b> <b>Messages not consistently delivered to two consumers bound to same key</b><br><br></div></blockquote><div></div><blockquote type="cite"><div><span>I'm using Rabbit 1.7.0 w/ the .Net client.</span><br><span></span><br><span>I am publishing messages with a routing key, say "A", and two queues</span><br><span>bound to that routing key on a Direct exchange:</span><br><span>_mqChannel.ExchangeDeclare(SHARED_EXCHANGE, ExchangeType.Direct, NOT_DURABLE);</span><br><span></span><br><span>(I've aliased the various boolean flags as variables so I can more</span><br><span>easily maintain the code; I fnd a series of true/false literals pretty</span><br><span>hard to remember.)</span><br><span></span><br><span>I then have a basic consumer on each of the queues dispatching.</span><br><span></span><br><span>It seems that messages published to A are being alternately delivered</span><br><span>to the two queues, rather than consistently to both queues.</span><br><span></span><br><span>Here's how I'm declaring and binding the queues (in separate processes):</span><br><span>_mqChannel.QueueDeclare(_busId, NOT_PASSIVE, NOT_DURABLE,</span><br><span>NOT_EXCLUSIVE, AUTODELETE, WAIT, new Hashtable());</span><br><span>_mqChannel.QueueBind(_busId, SHARED_EXCHANGE, "A", WAIT, null);</span><br><span></span><br><span>I then have a basic consumer on each of the queues:</span><br><span>var consumer = new QueueingBasicConsumer(_mqChannel);</span><br><span>_mqChannel.BasicConsume(_busId, null, consumer);</span><br><span>e = (BasicDeliverEventArgs)consumer.Queue.Dequeue();</span><br><span>...</span><br><span>If it matters, I'm acknowledging messages is *both* consumers as follows:</span><br><span></span><br><span>_mqChannel.BasicAck(e.DeliveryTag, false);</span><br><span></span><br><span></span><br><span>And here's how I'm publishing:</span><br><span>_mqChannel.BasicPublish(SHARED_EXCHANGE, "A", MANDATORY,</span><br><span>NOT_IMMEDIATE, props, <bytes>);</span><br><span></span><br><span>I was wondering what might cause this behavior?</span><br><span></span><br><span>While I'm here, are there any semantics to DeliveryTag? It appears to</span><br><span>be a sequentially-incrementing number, but it's not for all messages</span><br><span>published -- is it per consumer?</span><br><span></span><br><span>Just when I think I've got the hang of Rabbit, I find I'm still on</span><br><span>shaky ground. :-/</span><br></div></blockquote></body></html>