Announcement Announcement Module
Collapse
No announcement yet.
How do I do a basicAck from a MessageRecoverer? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do I do a basicAck from a MessageRecoverer?

    Hi,

    I have been using the MessageRecoverer in production for quite awhile now to handle messages that failed to be processed due to domain logic.

    Although this has worked great, one annoyance is seeing my error logs littered with the following:

    [code]
    ERROR ApplicationConfig - Recovered message forces ack (if ack mode requires it): (Body:'{"make":"Ford","model":"Mustang","year":"20 08"}'; ID:13791619-1b5c-42c2-b41d-e4a3ddfaf01f; Content:application/json; Headers:{__TypeId__=com.carfax.blueprint.amqp.Vehi cle}; Exchange:; RoutingKey:vehicle.changes; Reply:null; DeliveryMode:PERSISTENT; DeliveryTag:1)
    org.springframework.amqp.ImmediateAcknowledgeAmqpE xception: Recovered message forces ack (if ack mode requires it): (Body:'{"make":"Ford","model":"Mustang","year":"20 08"}'; ID:13791619-1b5c-42c2-b41d-e4a3ddfaf01f; Content:application/json; Headers:{__TypeId__=com.carfax.blueprint.amqp.Vehi cle}; Exchange:; RoutingKey:vehicle.changes; Reply:null; DeliveryMode:PERSISTENT; DeliveryTag:1)
    at org.springframework.amqp.rabbit.config.StatefulRet ryOperationsInterceptorFactoryBean$2.recover(State fulRetryOperationsInterceptorFactoryBean.java:94)
    at org.springframework.amqp.rabbit.config.StatefulRet ryOperationsInterceptorFactoryBean$2.recover(State fulRetryOperationsInterceptorFactoryBean.java:84)
    at org.springframework.retry.interceptor.StatefulRetr yOperationsInterceptor$ItemRecovererCallback.recov er(StatefulRetryOperationsInterceptor.java:207)
    at org.springframework.retry.support.RetryTemplate.ha ndleRetryExhausted(RetryTemplate.java:419)
    at org.springframework.retry.support.RetryTemplate.do Execute(RetryTemplate.java:288)
    at org.springframework.retry.support.RetryTemplate.ex ecute(RetryTemplate.java:186)
    at org.springframework.retry.interceptor.StatefulRetr yOperationsInterceptor.invoke(StatefulRetryOperati onsInterceptor.java:145)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :172)
    at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:202)
    at $Proxy37.invokeListener(Unknown Source)
    at org.springframework.amqp.rabbit.listener.SimpleMes sageListenerContainer.invokeListener(SimpleMessage ListenerContainer.java:560)
    at org.springframework.amqp.rabbit.listener.AbstractM essageListenerContainer.executeListener(AbstractMe ssageListenerContainer.java:452)
    at org.springframework.amqp.rabbit.listener.SimpleMes sageListenerContainer.doReceiveAndExecute(SimpleMe ssageListenerContainer.java:436)
    at org.springframework.amqp.rabbit.listener.SimpleMes sageListenerContainer.receiveAndExecute(SimpleMess ageListenerContainer.java:420)
    at org.springframework.amqp.rabbit.listener.SimpleMes sageListenerContainer.access$200(SimpleMessageList enerContainer.java:56)
    at org.springframework.amqp.rabbit.listener.SimpleMes sageListenerContainer$AsyncMessageProcessingConsum er.run(SimpleMessageListenerContainer.java:505)
    at java.lang.Thread.run(Thread.java:662)
    Caused by: org.springframework.amqp.rabbit.listener.ListenerE xecutionFailedException: Listener method 'handleMessage' threw exception
    at org.springframework.amqp.rabbit.listener.adapter.M essageListenerAdapter.invokeListenerMethod(Message ListenerAdapter.java:443)
    at org.springframework.amqp.rabbit.listener.adapter.M essageListenerAdapter.onMessage(MessageListenerAda pter.java:344)
    at org.springframework.amqp.rabbit.listener.AbstractM essageListenerContainer.doInvokeListener(AbstractM essageListenerContainer.java:506)
    at org.springframework.amqp.rabbit.listener.AbstractM essageListenerContainer.invokeListener(AbstractMes sageListenerContainer.java:470)
    at org.springframework.amqp.rabbit.listener.SimpleMes sageListenerContainer.access$001(SimpleMessageList enerContainer.java:56)
    at org.springframework.amqp.rabbit.listener.SimpleMes sageListenerContainer$1.invokeListener(SimpleMessa geListenerContainer.java:103)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.aop.support.AopUtils.invokeJoi npointUsingReflection(AopUtils.java:309)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.invokeJoinpoint(ReflectiveMethodInvocat ion.java:183)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :150)
    at org.springframework.retry.interceptor.StatefulRetr yOperationsInterceptor$MethodInvocationRetryCallba ck.doWithRetry(StatefulRetryOperationsInterceptor. java:173)
    at org.springframework.retry.support.RetryTemplate.do Execute(RetryTemplate.java:239)
    ... 12 more
    Caused by: java.lang.RuntimeException: BOOM!
    at com.carfax.blueprint.amqp.VehicleChangeListener.ha ndleMessage(VehicleChangeListener.java:10)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.util.MethodInvoker.invoke(Meth odInvoker.java:273)
    at org.springframework.amqp.rabbit.listener.adapter.M essageListenerAdapter.invokeListenerMethod(Message ListenerAdapter.java:437)
    ... 26 more

    [code]

    It seems that it wants a forced ack on the channel. I would... if I knew how to access the channel. I have my underhanded ways of accessing the channel but the truth is I have no guarentee that the channel I have injected is the true channel the message arrived on.

    Any ideas?

  • #2
    Where is that log coming from? I assume you added a custom ErrorHandler and it's from that? It should ignore ImmediateAcknowledgeAmqpException I guess.

    Comment


    • #3
      Yeah, I attached my own LoggingErrorHandler that simply logs all exceptions.

      Comment

      Working...
      X