Re: consumer received message from a queue it's not bound to? [c# rabbitmq-client, iis, servicestack]
This probably happens because both queues are bound to the exchange to receive a message. The reason for that may be an exchange type (fan-out for example will send message to any bound queue) or routing-key. Looking at your example, the routing-key used to bind queues is empty. Hence each message post with empty routing key will be delivered to both queues. You can run simple test to verify that. Just make sure all your queues are set up and then publish a message but do not run any consumers. Login to management portal to check to which queue the message has been routed to.
You can find more information about routing-key at [http://www.rabbitmq.com/amqp-0-9-1-reference.html#queue.bind.routing-key](http://www.rabbitmq.com/amqp-0-9-1-reference.html#queue.bind.routing-key)
On Wednesday, 16 July 2014 21:45:04 UTC+1, Steve Schoon wrote:
Here is my strange problem that I can't figure out how to fix:
consumer 1 write message 'a' to 'work-queue'
worker starts processing job 'a' (this takes a few minutes)
consumer 1 subscribes to 'queue-a' and try to consume 1 msg
consumer 2 subscribes to 'queue-b' and tries to consume 1 msg
worker completes processing job 'a'
worker writes 'a-is-done' message to 'queue-a'
** CONSUMER 2 RECEIVES THE 'a-is-done' WRITTEN TO 'queue-a' EVEN THOUGH IT'S CONSUMING FROM 'queue-b'
consumer 1 receives the expected message from 'queue-a'
worker starts processing job 'b'
worker completes processing job 'b'
worker writes 'b-is-done' message to 'queue-'b
'worker' is a console application that does the following in a forever loop:
reads 1 message from 'work-queue',
does some processing
write 1 message to 'queue-X' where 'X' is part of the message it read from 'work-queue'
'consumer1' and 'consumer2' are requests being handled by a a ServiceStack-based webservice running under IIS 7.5. The code looks like this:
string queueName = request.QueueName;
BasicDeliverEventArgs result = null;
var connectionFactory = new ConnectionFactory();
connectionFactory.Endpoint = new AmqpTcpEndpoint("myhostname");
connectionFactory.UserName = "user";
connectionFactory.Password = "pass";
using (IConnection connection = connectionFactory.CreateConnection())