Himanshu Yadav
Himanshu Yadav

Reputation: 13585

Implementing Competing Consumers Pattern using Camel

How can I keep my competing consumers completely dynamic?
Camel implementation is asking for concurrentConsumers value. But let's say if a new consumer boots up and start consuming the sender messages. How am I going to keep a count of concurrent consumers then?

Upvotes: 1

Views: 1568

Answers (1)

Ben ODay
Ben ODay

Reputation: 21015

I'm going to assume you are talking about JMS consumers...

If so, you can set the concurrentConsumers & maxConcurrentConsumers to allow the number of active consumer threads to grow/shrink based on demand. something like this will setup a route explicitly...

from("activemq:queue:input?concurrentConsumers=1&maxConcurrentConsumers=5")
.to("log:+++consumed+++");

that said, if you have other routes (or non-route consumers like Spring JMSTemplates, etc) that start consuming from the same resource (input queue), then the number of total consumers can go much higher...

you can always view the total number of active consumers in the AMQ web console or via JMX

Upvotes: 2

Related Questions