Announcement Announcement Module
Collapse
No announcement yet.
AMQP inbound channel adapter won't start when queue doesn't already exist Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • AMQP inbound channel adapter won't start when queue doesn't already exist

    In my application, I have an AMQP inbound channel adapter that listens to a single queue on a RabbitMQ server. The queue gets data from a different system all together. When RabbitMQ is restarted, the queue is destroyed, which is fine. The problem is that my application doesn't automatically declare the queue upon startup. I assumed having declared the queue using the rabbit namespace in my config, the queue would get created during startup, but that doesn't seem to be the case.

    The other system that publishes data to the queue doesn't use Spring at all. It just uses a basic RabbitMQ client setup which declares the queue in code. As soon as I publish something to the queue from that remote system, then my consuming application works fine. I just need to be able to have the queue created (if possible) by my consuming application if it doesn't already exist.

    This is my Spring Integration config.
    Code:
    <int-amqp:inbound-channel-adapter
    	channel="queuedDocketNumberChannel"
    	queue-names="${amqp.getCompanyQueue}"
    	error-channel="errorChannel"/>
    	
    <service-activator input-channel="queuedDocketNumberChannel" ref="queuedDocketNumberServiceActivator"/>
    	
    <rabbit:connection-factory id="rabbitConnectionFactory" host="${amqp.host}"/>
    	
    <rabbit:queue name="${amqp.getCompanyQueue}"/>
    Thanks.

  • #2
    You need a <rabbit:admin/> element to auto-declare queues, exchanges etc. Refer to the reference docs.

    For example...

    Code:
    <rabbit:admin connection-factory="connectionFactory" />

    Comment


    • #3
      Thanks Gary! That is indeed all I needed. It's my first time using AMQP and I jumped right into the Spring Integration AMQP support, so I was looking for the rabbit namespace documentation there, rather than in the Spring AMQP documentation.

      Thanks again

      Comment

      Working...
      X