[rabbitmq-discuss] Async consumer for .net client

Matthias Radestock matthias at rabbitmq.com
Fri Jan 7 09:51:02 GMT 2011


Vadim,

Vadim Chekan wrote:
> Is it possible to consume messages asynchronously in .net client?
> What I want is something like this (pseudocode)
> 
> var consumer = new SomeConsumer(_model, queue);
> consumer.OnRecieve = (msg) => {
>   ClearCache(); // do my stuff
>   _model.Ack(msg);
> }

See section 2.8 of the RabbitMQ .Net Client  Library User Guide:
<quote>
Another alternative is to subclass DefaultBasicConsumer, overriding 
methods as necessary, or implement IBasicConsumer directly. You will 
generally want to implement the core method HandleBasicDeliver.
</quote>

Make sure to also read the section after that on "Threading, deadlocks, 
and associated restrictions on consumers".


Regards,

Matthias.


More information about the rabbitmq-discuss mailing list