Announcement Announcement Module
Collapse
No announcement yet.
Meaning of SimpleMessageListenerContainer's concurrent consumers Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Meaning of SimpleMessageListenerContainer's concurrent consumers

    I am quite new to AMQP and would be grateful for some help understanding the effect of the
    SimpleMessageListenerContainer.setConcurrentConsum ers(int).

    When I start a single instance of my consumer class (first having specified, say, 3 concurrent consumers), the RabbitMQ management console shows me 3 consumers associated with the queue. But I've only instantiated and am running only one instance of the consumer class.

    The consumer class is on machine A, the producer (and broker) is on machine B.

    At first I thought the mgmt console might showing me the maximum number of consumers. But I also noticed under the "Consumers" section of the console a list of exactly 3 channels, whose IPs all indicate machine A.

    So at this point I can only conclude that I am seeing the effect of some kind of threading activity in the consumer, e.g., 3 threads....am I correct?

    Thanks.

    -Paul

  • #2
    You are correct: threading is what is going on in a nutshell - that's how the RabbitMQ Java client works, and how the Channel abstraction works in general - if you start 3 consumers you get 3 threads. We assume that your consumer is thread safe, so only one instance of it is required.

    Comment


    • #3
      Thank you, Dave. Thanks also for the reminder re thread safety!

      -Paul

      Comment

      Working...
      X