我在频道中使用了2个队列。 我声明了2个队列(Name1和Name2):
channel.QueueDeclare(queue: "Name1",
durable: false,
exclusive: false,
autoDelete: false,
arguments: null);
channel.QueueDeclare(queue: "Name2",
durable: false,
exclusive: false,
autoDelete: false,
var consumer = new EventingBasicConsumer(channel); arguments: null);
consumer.Received += (model, ea) =>
{
var body = ea.Body;
var message = Encoding.UTF8.GetString(body);
Console.WriteLine(message);
}
channel.BasicConsume(queue: "Name2",
noAck: true,
consumer: consumer);
channel.BasicConsume(queue: "Name1",
noAck: true,
consumer: consumer);
如何检测收到消息的队列:Name1或Name2?