Announcement Announcement Module
Collapse
No announcement yet.
Dynamic adjust instances of concurrentConsumers Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dynamic adjust instances of concurrentConsumers

    I noticed that SimpleMessageListenerContainer has a property - concurrentConsumers; I use it to setting the count of concurrent consumers:
    Code:
      <rabbit:listener-container connection-factory="connectionFactory" message-converter="jsonMessageConverter" concurrency="5" >
        <rabbit:listener queues="aQueue" ref="messageConsumer" method="handleMessage" />
      </rabbit:listener-container>
    My question is, how can i dynamic adjusting the instance count of concurrentConsumers that based on queue depth(total count of message remaining in the queue)? when depth of aQueue is large, increasing the count of concurrentConsumers; when its small, decreasing it.

    Besides:how can i get queue depth using spring-amqp API?

    All reply will be appreciated.

    Regards.
    Last edited by Wuaner; Jan 3rd, 2013, 09:46 PM.

  • #2
    No; the container doesn't currently support dynamic adjustment of the consumers; you have to stop/adjust/start the container to change it.

    No, the AMQP protocol doesn't support getting queue depths. You can, however, make REST calls to the Rabbit Admin plugin to get this information.

    Comment


    • #3
      thanks Gary.

      I searching the web found that in rabbit-java-client API there is a method maybe can use to find a queue's depth:
      http://lists.rabbitmq.com/pipermail/...ch/011656.html
      Code:
      Channel c = createChannel();
      AMQP.Queue.DeclareOK ok = c.queueDeclarePassive("my.queue");
      int messageCount = ok.getMessageCount();
      Or use RESTul with Rabbit-Admin-plugin just as you suggested.

      Cheers.

      Comment

      Working...
      X