I want to create single consumer(Generic Listener) for multiple queues.The consumer should listen multiple queues.
Lets see in the example
channel.ExchangeDeclare(exchange: "logs", type: "fanout");
var queueName = "QeueueName.Instance1";
channel.QueueBind(queue: queueName,
exchange: "logs",
routingKey: "");
Console.WriteLine(" [*] Waiting for logs.");
var consumer = new EventingBasicConsumer(channel);
consumer.Received += (model, ea) =>
{
var body = ea.Body;
var message = Encoding.UTF8.GetString(body);
Console.WriteLine(" [x] {0}", message);
};
I want to associate the consumer with dynamic no of queues and they will increase time to time so how i will associate consumer to future created queues.I have created a window service for the same so do i have to loop all the queues and associate with consumer and for the future created queues I should add them in the consumer queue list.