Spring AMQP
  1. Spring AMQP
  2. AMQP-312

Allow to dynamically add/remove queues from a running listener-container

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Complete
    • Affects Version/s: 1.1.1
    • Fix Version/s: 1.3.0.RC1
    • Component/s: RabbitMQ
    • Labels:

      Description

      My web-application is consuming messages sent by thousands of other publishing applications. I am trying to implement one-queue-per-publishing-application. I want to have a fixed number of inbound-adapters consuming messages from all these queues. Challenge is that these publishing applications get created/destroyed while my web-application is consuming messages. I want to be able to divide the queues available at start-up to the inbound-adapters and then add/remove queues from these adapters while they are consuming messages.

        Issue Links

          Activity

          Hide
          Dennis Laumen added a comment -

          Has anyone already thought of how to solve/implement this? I've been looking into the SimpleMessageListenerContainer and AbstractMessageListenerContainer source code but a solution isn't really apparent to me (naturally, I lack knowledge of the internal working of Spring AMQP / Rabbit).

          Show
          Dennis Laumen added a comment - Has anyone already thought of how to solve/implement this? I've been looking into the SimpleMessageListenerContainer and AbstractMessageListenerContainer source code but a solution isn't really apparent to me (naturally, I lack knowledge of the internal working of Spring AMQP / Rabbit).
          Hide
          Gary Russell added a comment -

          I have thought about it a little; I don't think it will be terribly hard, but it will require some restructuring.

          The current code of interest is in BlockingQueueConsumer; where in start he passively declares the queues (verifies they exist) and then issues a basicConsume for each queue.

          I believe we'll need to change this code (move the basicConsume calls elsewhere) and also keep track of the consumer tags (returned by basicConsume).

          When a new queue is added, in each blocking consumer, issue a basicConsume for it; when a queue is removed, find the corresponding consumer tag and issue a basicCancel.

          It will also need some work in the InternalConsumer - currently that treats a handleCancelOk call as if the whole BlockingQueueConsumer is going away.

          Show
          Gary Russell added a comment - I have thought about it a little; I don't think it will be terribly hard, but it will require some restructuring. The current code of interest is in BlockingQueueConsumer ; where in start he passively declares the queues (verifies they exist) and then issues a basicConsume for each queue. I believe we'll need to change this code (move the basicConsume calls elsewhere) and also keep track of the consumer tags (returned by basicConsume). When a new queue is added, in each blocking consumer, issue a basicConsume for it; when a queue is removed, find the corresponding consumer tag and issue a basicCancel. It will also need some work in the InternalConsumer - currently that treats a handleCancelOk call as if the whole BlockingQueueConsumer is going away.
          Hide
          Dennis Laumen added a comment -

          Thanks for the explanation Gary. I already have a workaround in place facilitated by the framework I'm using (Axon) so I no longer have a direct need for this feature. If someone is feeling brave though they now have the required information to create a nice pull request .

          Show
          Dennis Laumen added a comment - Thanks for the explanation Gary. I already have a workaround in place facilitated by the framework I'm using (Axon) so I no longer have a direct need for this feature. If someone is feeling brave though they now have the required information to create a nice pull request .
          Show
          Gary Russell added a comment - PR: https://github.com/spring-projects/spring-amqp/pull/162

            People

            • Assignee:
              Gary Russell
              Reporter:
              Kapil Goyal
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: