Please explain the difference between the usage of concurrentConsumers and spring.activemq.pool.max-connections in apache camel

Viewed 350

I spent almost two days understanding the concept concurrentconsumers vs spring.activemq.pool.max-connections in Apache Camel. but I really don't understand the concept. could anyone help me to understand the concept.

Can I use both?

Present scenario: Generic listener code for 6 producer services (different queue). the spring.activemq.pool.max-connections = 10.

A scenario which I need: 1 request should be processed at once in the listener sends to the downstream system. The producer gets the request of 10 req/sec I want the consumer to pick from queue and send 1 req/sec to the downstream system.

How can I change the number of consumers only to this route.

Thanks in advance.

1 Answers

I don't know the Spring configuration. Never needed it until now when using Camel.

However, the concurrentConsumers configuration of Camel defines, well, the number of concurrent consumers. If you set it to 1 the messages are processed sequentially. The consumer takes the first message, process it and then takes the next message.

If you set it to 5, 5 individual consumers are processing messages from the same queue.

How can I change the number of consumers only to this route.

You can change it for every individual consumer endpoint with the concurrentConsumers endpoint option. This overrules the generic configuration on the connection factory.

from("activemq:queue:yourQueue?concurrentConsumers=1")
    ...
Related