Spring AMQP
  1. Spring AMQP
  2. AMQP-311

Queues are created in passive mode, I don't see a "passive" flag in XML.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Invalid
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      http://stackoverflow.com/questions/16370911/how-to-get-spring-rabbitmq-to-create-a-new-queue/16371103?noredirect=1#comment23496325_16371103

      Using this xml:

      <rabbit:connection-factory id="rabbitConnectionFactory" host="172.16.45.1" username="test" password="password" />
      
      <rabbit:listener-container connection-factory="rabbitConnectionFactory"  >
          <rabbit:listener ref="testQueueListener" queue-names="test" />
      </rabbit:listener-container>
      
      <bean id="testQueueListener" class="com.levelsbeyond.rabbit.TestQueueListener"> 
      </bean>
      

      I see this error in RMQ:

      =ERROR REPORT==== 3-May-2013::23:17:24 ===
      connection <0.1652.0>, channel 1 - soft error:
      {amqp_error,not_found,"no queue 'test' in vhost '/'",'queue.declare'}
      

      I don't see a way to change the "passive" flag on the queue element, which is what I would expect to be able to do. Instead, adding an "admin" seems to fix it:

      <rabbit:listener-container connection-factory="rabbitConnectionFactory"  >
          <rabbit:listener ref="testQueueListener" queues="test" />
      </rabbit:listener-container>
      
      <rabbit:queue name="test"></rabbit:queue>
      
      <rabbit:admin id="amqpAdmin" connection-factory="rabbitConnectionFactory"/>
      
      <bean id="testQueueListener" class="com.levelsbeyond.rabbit.testQueueListener">   
      </bean>
      

      is this expected behavior? Should there be an "active" attribute on queue?

        Activity

        Hide
        Gary Russell added a comment - - edited

        It's not clear to me what you are asking.

        You can either pre-declare your queues using the Rabbit Management API (or otherwise statically via other rabbitmq configuration options).

        Or, as documented in the reference (http://static.springsource.org/spring-amqp/reference/html/amqp.html#broker-configuration).

        "The AMQP specification describes how the protocol can be used to configure Queues, Exchanges and Bindings on the broker. These operations which are portable from the 0.8 specification and higher are present in the AmqpAdmin interface in the org.springframework.amqp.core package. The RabbitMQ implementation of that class is RabbitAdmin located in the org.springframework.amqp.rabbit.core package."

        You can add a RabbitAdmin to your config to auto-declare any queues you need.

        The container itself uses queueDeclarePassive so it can fail fast if the queue has not previously been declared.

        Show
        Gary Russell added a comment - - edited It's not clear to me what you are asking. You can either pre-declare your queues using the Rabbit Management API (or otherwise statically via other rabbitmq configuration options). Or, as documented in the reference ( http://static.springsource.org/spring-amqp/reference/html/amqp.html#broker-configuration ). "The AMQP specification describes how the protocol can be used to configure Queues, Exchanges and Bindings on the broker. These operations which are portable from the 0.8 specification and higher are present in the AmqpAdmin interface in the org.springframework.amqp.core package. The RabbitMQ implementation of that class is RabbitAdmin located in the org.springframework.amqp.rabbit.core package." You can add a RabbitAdmin to your config to auto-declare any queues you need. The container itself uses queueDeclarePassive so it can fail fast if the queue has not previously been declared.

          People

          • Assignee:
            Gary Russell
            Reporter:
            Eric Cobb
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: