You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Brad Harvey (Jira)" <ji...@apache.org> on 2020/07/29 11:54:00 UTC

[jira] [Created] (CAMEL-15350) SJMS Batch Consumer error recovery

Brad Harvey created CAMEL-15350:
-----------------------------------

             Summary: SJMS Batch Consumer error recovery
                 Key: CAMEL-15350
                 URL: https://issues.apache.org/jira/browse/CAMEL-15350
             Project: Camel
          Issue Type: Bug
          Components: camel-sjms
    Affects Versions: 3.4.1
            Reporter: Brad Harvey


If the SJMS-Batch consumption loop encounters anything other than a javax.jms.IllegalStateException ([https://github.com/apache/camel/blob/master/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/batch/SjmsBatchConsumer.java#L330]) then it logs a warning and stops consuming messages ([https://github.com/apache/camel/blob/master/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/batch/SjmsBatchConsumer.java#L348)].

Example log after message broker is shut down:
{code:java}
 2020-07-29 10:33:32.060 WARN ||| 34468 --- [msBatchConsumer] o.a.c.c.sjms.batch.SjmsBatchConsumer     : Exception caught consuming from myQueue. Caused by: [javax.jms.JMSException - Connection refused: no further information: localhost/127.0.0.1:5672]

javax.jms.JMSException: Connection refused: no further information: localhost/127.0.0.1:5672
    at org.apache.qpid.jms.provider.ProviderException.toJMSException(ProviderException.java:34)
    at org.apache.qpid.jms.exceptions.JmsExceptionSupport.create(JmsExceptionSupport.java:80)
    at org.apache.qpid.jms.exceptions.JmsExceptionSupport.create(JmsExceptionSupport.java:112)
    at org.apache.qpid.jms.JmsConnection.pull(JmsConnection.java:915)
    at org.apache.qpid.jms.JmsConnection.pull(JmsConnection.java:899)
    at org.apache.qpid.jms.JmsMessageConsumer.performPullIfRequired(JmsMessageConsumer.java:732)
    at org.apache.qpid.jms.JmsMessageConsumer.dequeue(JmsMessageConsumer.java:332)
    at org.apache.qpid.jms.JmsMessageConsumer.receive(JmsMessageConsumer.java:213)
    at org.springframework.jms.connection.CachedMessageConsumer.receive(CachedMessageConsumer.java:86)
    at org.apache.camel.component.sjms.batch.SjmsBatchConsumer$BatchConsumptionLoop$BatchConsumptionTask.consumeBatchesOnLoop(SjmsBatchConsumer.java:427)
    at org.apache.camel.component.sjms.batch.SjmsBatchConsumer$BatchConsumptionLoop$BatchConsumptionTask.access$1300(SjmsBatchConsumer.java:381)
    at org.apache.camel.component.sjms.batch.SjmsBatchConsumer$BatchConsumptionLoop.run(SjmsBatchConsumer.java:326)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.qpid.jms.provider.exceptions.ProviderIOException: Connection refused: no further information: localhost/127.0.0.1:5672{code}
{{}}

It is not obvious from this log message that the route is now broken and will not receive any more messages. The route state is still "Started".

 

 

Expected Behaviour: The batch consumer can recover after errors (including a broker restart or failover) and continue to consume messages once the broker is available again.

 

A simple change is to catch any exception instead of only javax.jms.IllegalStateException.

 

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)