Andrea Cosentino created CAMEL-24934:
----------------------------------------

             Summary: camel-pulsar - a failed acknowledgement is reported 
without its cause
                 Key: CAMEL-24934
                 URL: https://issues.apache.org/jira/browse/CAMEL-24934
             Project: Camel
          Issue Type: Bug
          Components: camel-pulsar
            Reporter: Andrea Cosentino
            Assignee: Andrea Cosentino


h3. Summary

When acknowledging a message fails, the consumer hands 
{{exchange.getException()}} to the exception
handler, and on that branch it is {{null}} by construction. The real cause is 
dropped.

h3. Details

{{PulsarMessageListener.processAsync}}:

{code:java}
if (exchange.getException() != null) {
    pulsarConsumer.getExceptionHandler().handleException("Error processing 
exchange", exchange,
            exchange.getException());
} else {
    try {
        acknowledge(consumer, message);
    } catch (Exception e) {
        pulsarConsumer.getExceptionHandler().handleException("Error processing 
exchange", exchange,
                exchange.getException());
    }
}
{code}

The {{catch}} sits in the {{else}} of {{exchange.getException() != null}}, so 
{{exchange.getException()}}
is {{null}} there and the caught {{e}} is never used. A failing acknowledgement 
- a closed consumer, an
unreachable broker, an acknowledgement timeout - is therefore reported with no 
cause and no stack trace,
and the message will be redelivered later with nothing in the log explaining 
why.

h3. Proposed fix

Pass {{e}}, and give the message its own wording so the two branches are 
distinguishable in a log.

----
_Reported by Claude Code on behalf of oscerd (Andrea Cosentino)._



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to