[rabbitmq-discuss] Multiple consumers
Adriana Rodean
adrya1984 at gmail.com
Tue Jul 28 07:56:03 BST 2009
Hi,
I have this example of a publisher:
string exchangeName = "{27}{47}{System}", queueName =
"{27}{47}{System}", routingKey = "System";
channel.ExchangeDeclare(exchangeName, ExchangeType.Topic);
channel.QueueDeclare(queueName);
channel.QueueBind(queueName, exchangeName, routingKey, false, null);
byte[] messageBodyBytes =
System.Text.Encoding.UTF8.GetBytes("Hello, world! 27_2");
IBasicProperties props = channel.CreateBasicProperties();
props.ContentType = "text/plain";
props.DeliveryMode = 2;
channel.BasicPublish(exchangeName, routingKey, props,
messageBodyBytes);
And 2 different applications that subscribe to it with this code:
Subscription sub = new Subscription(channel, queueName);
foreach (BasicDeliverEventArgs e in sub)
{
Console.WriteLine(Encoding.UTF8.GetString(e.Body));
}
When i publish message 1 subscriber receives the message. After i
close this subscriber the other one receives the message.
I want both subscribers to receive the message when they are open.
What am i doing wrong?
Please help!
Thanks,
Adriana
More information about the rabbitmq-discuss
mailing list