Uploaded image for project: 'Spring AMQP'
  1. Spring AMQP
  2. AMQP-518

rabbit:listener-container is not using the provided id

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Complete
    • Affects Version/s: 1.5 M1
    • Fix Version/s: 1.5 RC1
    • Component/s: None
    • Labels:
    • Environment:
      Java 8, Spring 4.1.6.

      Description

      I have an application context with three listener containers defined:

        <rabbit:listener-container  id="manualAcknowledge" connection-factory="rabbitConnectionFactory" acknowledge="manual"
                                   task-executor="asyncMessageExecutor">
          <rabbit:listener ref="client.direct" queues="queue.1.ccad-test-client"/>
        </rabbit:listener-container>
      
        <rabbit:listener-container id="autoAcknowledge" connection-factory="rabbitConnectionFactory" acknowledge="auto"
                                   task-executor="asyncMessageExecutor" auto-startup="false">
          <rabbit:listener ref="client.string.adapted" queues="queue.2.ccad-test-client" method="handleMessage"/>
        </rabbit:listener-container>
      
        <bean id="client.string.adapted"
              class="com.ccadllc.firebird.core.rabbitmq.client.impl.SimpleStringAdaptedListenerExample"/>
        <bean id="client.direct" class="com.ccadllc.firebird.core.rabbitmq.client.impl.DirectListenerExample"/>
      
        <bean id="repoMessageListener" class="com.ccadllc.firebird.core.rabbitmq.client.impl.marshaling.RepoMessageListener"/>
      
        <rabbit:listener-container id="repoMessageContainer" connection-factory="rabbitConnectionFactory" acknowledge="manual"
                                   task-executor="asyncMessageExecutor" auto-startup="false">
          <rabbit:listener ref="repoMessageListener" queues="queue.3.ccad-test-client-repos"/>
        </rabbit:listener-container>
      

      When I try to reference the beans by the id that I provide, the beans are not found.
      Turning on debug logging for org.springframework.beans, I found that the beans were being created, but with auto-generated ids:
      org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer#0
      org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer#1
      org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer#2

      When I referenced them using the auto-generated ids, the beans were found and the application worked.
      FWIW, this is an upgrade of an existing Spring 3.x, Java 1.6 application to Java 8, Spring 4.1.6.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              grussell Gary Russell
              Reporter:
              merinoff Mark Erinoff
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: