Announcement Announcement Module
No announcement yet.
Suspend consumers without deleting autodelete queues Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Suspend consumers without deleting autodelete queues

    I kind of have a weired requirement where System engineer will want to suspending queue consumers(not stop).

    The cases for suspending consumers can be as follows :
    System Engg temporily wants to detach a consumer.
    Some configuration changes being made to consumer.

    I thought of achieving this with listenerContainer.stop and listnerContainer.start (using jmx or control bus etc).

    But there are lot of cases where the queues I create are AutoDelete Queues, in these cases, the queues gets deleted when the system engineer shuts the consumer (assuming there is only one consumer for that service).

    So instead of stop and start, I need a suspend where the physical connection between the consumer and rabbit broker is still held, but consumer do not listen to incoming message.

    Would appriciate any pointers to acheive this.

    May be I need some kind of SuspendableBlockingQueueConsumer implemenation or so. Is there any thing already available in SI/SI-amqp?

  • #2
    There's no concept of a "paused" consumer in AMQP itself (let alone spring-amqp or SI).

    One thing you could do is add an advice to the listener container's advice-chain that would suspend the container's threads, but it's important to understand that each thread would be paused when a message arrives and you'd have an in-process delivery running on each thread. When the maintenance period is over, the advice would let the threads proceed.

    auto-delete queues are a little scary to me in this environment; if you don't want the queue to be deleted during this maintenance period, it would seem you wouldn't want it deleted if, say, the consumer failed for some reason.