I want to configure a spring integration application so that if I put a number of tasks, each represented by one message, on a channel then one of a group of endpoints will pick the next task and process it. This would entail some thread pool executor service I guess.
Competing Consumers are multiple consumers that are all created to receive messages from a single Point-to-Point Channel. When the channel delivers a message, any of the consumers could potentially receive it.
Messaging protocols supported by RabbitMQ use both terms but RabbitMQ documentation tends to prefer the latter. In this sense a consumer is a subscription for message delivery that has to be registered before deliveries begin and can be cancelled by the application.
Yes, use a dispatcher + task executor with the channel (aka ExecutorChannel). That way any endpoint (e.g. service-activator
) consuming from the channel will be invoked asynchronously using dispatcher's thread pool.
In the following example, any messages landing on channel channel01
will be consumed by the jobLauncher
service within one of the taskExecutor
threads.
<int:channel id="channel01">
<int:dispatcher task-executor="taskExecutor">
</int:channel>
<task:executor id="taskExecutor" pool-size="2"/>
<int:service-activator input-channel="channel01" ref="jobLauncher">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With