Announcement Announcement Module
Collapse
No announcement yet.
Adding new temporary RabbitMQ message listeners during runtime? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Adding new temporary RabbitMQ message listeners during runtime?

    Hi,

    I have a requirement to create programmatically during runtime new queues and their respective message listeners that will listen to them. Moreover, these queues/listeners should be temporary, meaning, I would like to have some timeout mechanism after which queue/listener should be removed from RabbitMQ.

    Any guides how to achieve this? Current documentation mainly just tackles with fixed message consumers, declared usually at the app boot time, but I don't need this here.

    Regards,
    Vjeran

  • #2
    Use a RabbitAdmin to declare a Queue and Binding.
    Instantiate a SimpleMessageListenerContainer; configure it (set properties - queue name, listener etc).
    call 'afterPropertiesSet()'
    Start it.
    ...
    Stop it.
    Destroy it.

    Comment


    • #3
      Thanx a bunch.
      Actually, I thought that the way you specified above is kind of "heavyweight" for some operation that has to be performed often since I need this queues/listeners for reply messages coming from some remote platform where I'm sending requests also via AMQP/rabbitmq queues.

      I was looking at the code, and only thing I found was protected RabbitTemplate.doSendAndReceiveWithTemporary() method which also sends and blocks temporarily for reply, but it seems a bit low level....

      Comment


      • #4
        Well, I responded to your specific question

        ...programmatically during runtime new queues and their respective message listeners that will listen to them. ...
        You should describe your use case rather than asking specific questions and maybe someone can help you.

        Comment

        Working...
        X