Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-15350

SJMS Batch Consumer error recovery

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.4.1
    • 3.4.3, 3.5.0
    • camel-sjms
    • None
    • Unknown

    Description

      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:

       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

      {{}}

      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.

       

       

      Attachments

        1. CAMEL-15350-reproducer-patch.txt
          6 kB
          Brad Harvey
        2. CAMEL-15350-patch.txt
          2 kB
          Brad Harvey

        Activity

          People

            davsclaus Claus Ibsen
            bradhgbst Brad Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: