var consumer = new EventingBasicConsumer(channel);
channel.QueueDeclare(QueueName, true, false, false);
channel.BasicConsume(queue: QueueName, autoAck: false, consumer: consumer);
consumer.Received += (model, ea) =>
{
//do something
}
vs
channel.ExchangeDeclare(ExchangeName, "topic");
channel.QueueDeclare(QueueName,false, false, true, null);
channel.QueueBind(QueueName, ExchangeName, topicroutingKey);
channel.BasicQos(0, 10, false);
Subscription subscription = new Subscription(channel, QueueName, false);
while (true)
{
BasicDeliverEventArgs deliveryArguments = subscription.Next();
//do something
}
Is a new thread started in both of them ??
at
consumer.Received += (model, ea) => {//do something}
and
BasicDeliverEventArgs deliveryArguments = subscription.Next();
Or is it in none of them, Pros and cons of using above two approaches
Any inputs/suggestions are welcome,