[rabbitmq-discuss] Non-blocking Consumers approach
tim at rabbitmq.com
Mon Aug 27 10:17:08 BST 2012
On 27 Aug 2012, at 08:58, Mahesh Viraktamath wrote:
> We used RabbitMQ to implement a simple producer-consumer architecture.
> It was fine until very recently, when we encountered the blocking
> calls. I ran two nodes in a cluster; in cases where the consumer took
> more than the usual time and all subsequent messages kept on waiting.
> Then, I came to know that I used QueuingConsumer which is a blocking
> architecture, now I know I have to use my own implementation of the
> DefaultConsumer. But, I am clueless as to whether I should manage the
> threading model or the RabbitMQ itself has any provision on that.
> Another thing that is confusing is, whether we run different type of
> consumers (with different duties) separately or we maintain a single
> main class which will start consumers as the messages come in.
Have you read the API guide (http://www.rabbitmq.com/api-guide.html) for details about threading and using your own executor service? That's probably a good place to start. The latter question (about choosing how to structure your code) is really something you'll have to decide yourself, based on the responsibilities of each class and whether or not and to what extent separation makes sense in the design.
More information about the rabbitmq-discuss