[rabbitmq-discuss] Parallel processing with QueueingBasicConsumer

Mark Ward ward.mark at gmail.com
Tue Nov 13 22:32:41 GMT 2012


Hi,

What I would like to double check is if when using a QueueingBasicConsumer
if it is possible to spawn a Task/Thread for each dequeued item.  Then in
each Task/Thread it will perform the ack.

Is it ok to call the BasicAck in a Task/Thread below?  The code is only to
illustrate the idea.

prefetch = 10

while ( ..... )

{

_amqpBasicConsumer.Queue.Dequeue((int)DequeueTimeout.TotalMilliseconds, out
o);

if ( o == null) continue;

BasicDeliverEventArgs basicDeliverEventArgs = (BasicDeliverEventArgs)o;
  System.Threading.Tasks.Task.Factory.StartNew(() =>{
		// do work on o
		_model.BasicAck(basicDeliverEventArgs.DeliveryTag, false);  <--- gets
called in a thread on a _model
});

}



--
View this message in context: http://rabbitmq.1065348.n5.nabble.com/Parallel-processing-with-QueueingBasicConsumer-tp23355.html
Sent from the RabbitMQ mailing list archive at Nabble.com.


More information about the rabbitmq-discuss mailing list