[rabbitmq-discuss] RabbitMQ and Camel : route interrupted due to "Message dropped on recovery"

Andrea Girardi andrea.girardi at gmail.com
Fri Jan 11 13:34:25 GMT 2013



Hi there,



I'm having a frustrating issue with RabbitMQ and sprimg-amqp, maybe someone 
could help me.


I need to send a message to a queue from an external process (a JUnit class 
just to test if routing works well). This is my camel-context.xml file:


 <camelContext xmlns="http://camel.apache.org/schema/spring">

<route> 

<from uri=
"spring-amqp:KipcastDirect:KipcastQueue:KipcastRouting?type=direct&amp;autodelete=true&amp;durable=true" 
/>

<log message="Message received!!! "/> 

<to   uri=
"spring-amqp:KipcastDirect2:TestQueue:KipcastRouting2?type=direct&amp;autodelete=false&amp;durable=true" 
/>

</route>

</camelContext>


when I started it using maven camel:run it works fine. The exchange is 
available and also queue in RabbitMQ Management. The problem happens when I 
try to send a message to that Exchange:


ConnectionFactory factory = new ConnectionFactory();

factory.setHost("10.211.55.20");

factory.setPort(5672);

factory.setVirtualHost("/");

factory.setUsername("guest");

factory.setPassword("guest");

Connection connection = factory.newConnection();

Channel channel = connection.createChannel();


channel.exchangeDeclare("KipcastDirect", "direct", 

   true, /* durable */

   true, /* autodelete */

   null); /* */

   

byte[] messageBodyBytes = "Hello, world!".getBytes();

  

AMQP.BasicProperties.Builder bob = new AMQP.BasicProperties.Builder();

AMQP.BasicProperties minBasic = bob.build();

minBasic = bob.priority(0).messageId("Test").build(); 

minBasic = bob.priority(0).deliveryMode(1).build(); 


while (true) {


    channel.basicPublish("KipcastDirect", "KipcastRouting", minBasic, 
messageBodyBytes);

    System.out.println(" [x] Sent ");

    

}


Messages are correctly sent to queue (I can see them on log) but an 
exception is raised and the route is stopped:


[     SimpleAsyncTaskExecutor-1] SpringAMQPConsumer             WARN  
Caused by: [
org.springframework.amqp.rabbit.listener.ListenerExecutionFailedException - 
Listener threw exception]

org.springframework.amqp.rabbit.listener.ListenerExecutionFailedException: 
Listener threw exception

at 
org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.wrapToListenerExecutionFailedExceptionIfNeeded(
AbstractMessageListenerContainer.java:590)[spring-rabbit-1.0.0.RELEASE.jar:]

at 
org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(
AbstractMessageListenerContainer.java:529)[spring-rabbit-1.0.0.RELEASE.jar:]

at 
org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.invokeListener(
AbstractMessageListenerContainer.java:472)[spring-rabbit-1.0.0.RELEASE.jar:]

at 
org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$001(
SimpleMessageListenerContainer.java:56)[spring-rabbit-1.0.0.RELEASE.jar:]

at 
org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$1.invokeListener(
SimpleMessageListenerContainer.java:103)[spring-rabbit-1.0.0.RELEASE.jar:]

at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)[:1.6.0_37]

at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_37]

at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(
AopUtils.java:309)[spring-aop-3.0.7.RELEASE.jar:3.0.7.RELEASE]

at 
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(
ReflectiveMethodInvocation.java:183
)[spring-aop-3.0.7.RELEASE.jar:3.0.7.RELEASE]

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:150
)[spring-aop-3.0.7.RELEASE.jar:3.0.7.RELEASE]

at 
org.springframework.retry.interceptor.StatefulRetryOperationsInterceptor$MethodInvocationRetryCallback.doWithRetry(
StatefulRetryOperationsInterceptor.java:173
)[spring-retry-1.0.0.RELEASE.jar:]

at org.springframework.retry.support.RetryTemplate.doExecute(
RetryTemplate.java:239)[spring-retry-1.0.0.RELEASE.jar:]

at org.springframework.retry.support.RetryTemplate.execute(
RetryTemplate.java:186)[spring-retry-1.0.0.RELEASE.jar:]

at 
org.springframework.retry.interceptor.StatefulRetryOperationsInterceptor.invoke(
StatefulRetryOperationsInterceptor.java:145
)[spring-retry-1.0.0.RELEASE.jar:]

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:172
)[spring-aop-3.0.7.RELEASE.jar:3.0.7.RELEASE]

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(
JdkDynamicAopProxy.java:202)[spring-aop-3.0.7.RELEASE.jar:3.0.7.RELEASE]

at $Proxy46.invokeListener(Unknown Source)[:]

at 
org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.invokeListener(
SimpleMessageListenerContainer.java:560)[spring-rabbit-1.0.0.RELEASE.jar:]

at 
org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.executeListener(
AbstractMessageListenerContainer.java:452)[spring-rabbit-1.0.0.RELEASE.jar:]

at 
org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doReceiveAndExecute(
SimpleMessageListenerContainer.java:436)[spring-rabbit-1.0.0.RELEASE.jar:]

at 
org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.receiveAndExecute(
SimpleMessageListenerContainer.java:420)[spring-rabbit-1.0.0.RELEASE.jar:]

at 
org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$200(
SimpleMessageListenerContainer.java:56)[spring-rabbit-1.0.0.RELEASE.jar:]

at 
org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(
SimpleMessageListenerContainer.java:505)[spring-rabbit-1.0.0.RELEASE.jar:]

at java.lang.Thread.run(Thread.java:680)[:1.6.0_37]

[     SimpleAsyncTaskExecutor-1] erationsInterceptorFactoryBean WARN  
Message dropped on recovery: (Body:'Hello, world!'; ID:Test; 
Content:text/plain; Headers:{}; Exchange:KipcastDirect; 
RoutingKey:KipcastRouting; Reply:null; DeliveryMode:NON_PERSISTENT; 
DeliveryTag:2)

org.springframework.amqp.rabbit.listener.ListenerExecutionFailedException: 
Listener threw exception

at 
org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.wrapToListenerExecutionFailedExceptionIfNeeded(
AbstractMessageListenerContainer.java:590)[spring-rabbit-1.0.0.RELEASE.jar:]

at 
org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(
AbstractMessageListenerContainer.java:529)[spring-rabbit-1.0.0.RELEASE.jar:]

at 
org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.invokeListener(
AbstractMessageListenerContainer.java:472)[spring-rabbit-1.0.0.RELEASE.jar:]

at 
org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$001(
SimpleMessageListenerContainer.java:56)[spring-rabbit-1.0.0.RELEASE.jar:]

at 
org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$1.invokeListener(
SimpleMessageListenerContainer.java:103)[spring-rabbit-1.0.0.RELEASE.jar:]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.6.0_37]

at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)[:1.6.0_37]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)[:1.6.0_37]

at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_37]

at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(
AopUtils.java:309)[spring-aop-3.0.7.RELEASE.jar:3.0.7.RELEASE]

at 
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(
ReflectiveMethodInvocation.java:183
)[spring-aop-3.0.7.RELEASE.jar:3.0.7.RELEASE]

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:150
)[spring-aop-3.0.7.RELEASE.jar:3.0.7.RELEASE]

at 
org.springframework.retry.interceptor.StatefulRetryOperationsInterceptor$MethodInvocationRetryCallback.doWithRetry(
StatefulRetryOperationsInterceptor.java:173
)[spring-retry-1.0.0.RELEASE.jar:]

at org.springframework.retry.support.RetryTemplate.doExecute(
RetryTemplate.java:239)[spring-retry-1.0.0.RELEASE.jar:]

at org.springframework.retry.support.RetryTemplate.execute(
RetryTemplate.java:186)[spring-retry-1.0.0.RELEASE.jar:]

at 
org.springframework.retry.interceptor.StatefulRetryOperationsInterceptor.invoke(
StatefulRetryOperationsInterceptor.java:145
)[spring-retry-1.0.0.RELEASE.jar:]

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:172
)[spring-aop-3.0.7.RELEASE.jar:3.0.7.RELEASE]

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(
JdkDynamicAopProxy.java:202)[spring-aop-3.0.7.RELEASE.jar:3.0.7.RELEASE]

at $Proxy46.invokeListener(Unknown Source)[:]

at 
org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.invokeListener(
SimpleMessageListenerContainer.java:560)[spring-rabbit-1.0.0.RELEASE.jar:]

at 
org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.executeListener(
AbstractMessageListenerContainer.java:452)[spring-rabbit-1.0.0.RELEASE.jar:]

at 
org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doReceiveAndExecute(
SimpleMessageListenerContainer.java:436)[spring-rabbit-1.0.0.RELEASE.jar:]

at 
org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.receiveAndExecute(
SimpleMessageListenerContainer.java:420)[spring-rabbit-1.0.0.RELEASE.jar:]

at 
org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$200(
SimpleMessageListenerContainer.java:56)[spring-rabbit-1.0.0.RELEASE.jar:]

at 
org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(
SimpleMessageListenerContainer.java:505)[spring-rabbit-1.0.0.RELEASE.jar:]

at java.lang.Thread.run(Thread.java:680)[:1.6.0_37]


What's wrong with that? What's the reason for which I must generate the 
Message ID?


thanks for your time, I really appreciate that.


Andrea
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130111/457257ed/attachment.htm>


More information about the rabbitmq-discuss mailing list