Search code examples
springmessage-queuemessagingspring-integrationevent-driven-design

Spring Integration - Maximum Throughput Consumer


What configuration of Spring Integration elements, if any, would support the model of:

  • One message queue, representing incoming work
  • Multiple consumers reading from that queue (one message only needs to go to one consumer)
  • Each consumer only polls when it has no work to do; if it is currently processing a message, then don't poll. If it is doing no work, poll every X seconds to see if new work has arrived.

Solution

  • Assuming you mean with JMS,

    <jms:message-driven-channel-adapter/>
    

    See attributes such as concurrent-consumers, max-concurrent-consumers, idle-consumer-limit, idle-task-execution-limit.

    The consumer management is all done by the underlying core Spring DefaultMessageListenerContainer.