FYI, I just pasted your config, pretty much verbatim, into the spring-integration AMQP sample app (replacing the inbound adapter with your container/test listener), and everything works fine. I even waited 5 minutes...
Code:
diff --git a/basic/amqp/pom.xml b/basic/amqp/pom.xml
index 3edaf6c..e619cd3 100644
--- a/basic/amqp/pom.xml
+++ b/basic/amqp/pom.xml
@@ -12,7 +12,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <spring.integration.version>2.1.0.RELEASE</spring.integration.version>
+ <spring.integration.version>2.2.0.RC1</spring.integration.version>
<log4j.version>1.2.16</log4j.version>
<junit.version>4.10</junit.version>
</properties>
diff --git a/basic/amqp/src/main/resources/META-INF/spring/integration/spring-integration-context.xml b/basic/amqp/src/main/resources/META-INF/spring/integration/spring-integration-context.xml
index 125457f..50e057e 100644
--- a/basic/amqp/src/main/resources/META-INF/spring/integration/spring-integration-context.xml
+++ b/basic/amqp/src/main/resources/META-INF/spring/integration/spring-integration-context.xml
@@ -5,11 +5,13 @@
xmlns:int-amqp="http://www.springframework.org/schema/integration/amqp"
xmlns:rabbit="http://www.springframework.org/schema/rabbit"
xmlns:int-stream="http://www.springframework.org/schema/integration/stream"
+ xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/integration/amqp http://www.springframework.org/schema/integration/amqp/spring-integration-amqp.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/stream http://www.springframework.org/schema/integration/stream/spring-integration-stream.xsd
http://www.springframework.org/schema/rabbit http://www.springframework.org/schema/rabbit/spring-rabbit.xsd
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">
<!-- From STDIN To RabbitMQ -->
@@ -25,9 +27,49 @@
<!-- From RabbitMQ To STDOUT -->
- <int-amqp:inbound-channel-adapter channel="fromRabbit"
- queue-names="si.test.queue"
- connection-factory="connectionFactory" />
+<!-- <int-amqp:inbound-channel-adapter channel="fromRabbit" -->
+<!-- queue-names="si.test.queue" -->
+<!-- connection-factory="connectionFactory" /> -->
+
+ <bean id="listener.container" class="org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer">
+ <property name="channelTransacted" value="false" />
+ <property name="concurrentConsumers" value="2" />
+ <property name="prefetchCount" value="1" />
+ <property name="connectionFactory" ref="connectionFactory" />
+ <property name="acknowledgeMode" value="AUTO" />
+ <property name="queues" value="si.test.queue" />
+ <property name="autoStartup" value="true" />
+ <property name="messageListener">
+ <bean class="org.springframework.integration.samples.amqp.SimpleMsgListener" />
+ </property>
+ <property name="adviceChain" ref="retryChain" />
+ </bean>
+
+ <bean id="retryOperationsInterceptor" class="org.springframework.amqp.rabbit.config.StatefulRetryOperationsInterceptorFactoryBean">
+ <property name="retryOperations">
+ <bean class="org.springframework.retry.support.RetryTemplate">
+ <property name="retryPolicy">
+ <bean class="org.springframework.retry.policy.SimpleRetryPolicy">
+ <property name="maxAttempts" value="2" />
+ </bean>
+ </property>
+ <property name="backOffPolicy">
+ <bean class="org.springframework.retry.backoff.FixedBackOffPolicy">
+ <property name="backOffPeriod" value="1000" />
+ </bean>
+ </property>
+ </bean>
+ </property>
+ </bean>
+
+ <util:list id="retryChain">
+ <bean class="org.springframework.amqp.rabbit.retry.MissingMessageIdAdvice">
+ <constructor-arg>
+ <bean class="org.springframework.retry.policy.MapRetryContextCache" />
+ </constructor-arg>
+ </bean>
+ <ref bean="retryOperationsInterceptor" />
+ </util:list>
<int:channel id="fromRabbit">
<int:interceptors>
Code:
18:24:02.478 INFO [main][org.springframework.integration.samples.amqp.Main]
=========================================================
Welcome to Spring Integration!
For more information please visit:
http://www.springsource.org/spring-integration
=========================================================
18:24:03.828 WARN [main][org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer] CachingConnectionFactory's channelCacheSize can not be less than the number of concurrentConsumers so it was reset to match: 2
18:24:04.156 INFO [main][org.springframework.integration.samples.amqp.Main]
=========================================================
This is the AMQP Sample -
Please enter some text and press return. The entered
Message will be sent to the configured RabbitMQ Queue,
then again immediately retrieved from the Message
Broker and ultimately printed to the command line.
=========================================================
ddd
18:24:09.117 INFO [SimpleAsyncTaskExecutor-1][org.springframework.integration.samples.amqp.SimpleMsgListener] Message received: ddd
fff
18:24:11.996 INFO [SimpleAsyncTaskExecutor-2][org.springframework.integration.samples.amqp.SimpleMsgListener] Message received: fff
ggg
18:24:14.997 INFO [SimpleAsyncTaskExecutor-1][org.springframework.integration.samples.amqp.SimpleMsgListener] Message received: ggg
hhh
18:24:17.998 INFO [SimpleAsyncTaskExecutor-2][org.springframework.integration.samples.amqp.SimpleMsgListener] Message received: hhh
hhh
18:25:00.009 INFO [SimpleAsyncTaskExecutor-1][org.springframework.integration.samples.amqp.SimpleMsgListener] Message received: hhh
123
18:25:08.011 INFO [SimpleAsyncTaskExecutor-2][org.springframework.integration.samples.amqp.SimpleMsgListener] Message received: 123
wait for 5 mins
18:30:55.089 INFO [SimpleAsyncTaskExecutor-1][org.springframework.integration.samples.amqp.SimpleMsgListener] Message received: wait for 5 mins