You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2026/07/15 16:02:00 UTC

[jira] [Commented] (CAMEL-24075) camel-jms: transferException=true silently swallows processing failures (and commits the transaction) when the message has no JMSReplyTo

    [ https://issues.apache.org/jira/browse/CAMEL-24075?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18096540#comment-18096540 ] 

Claus Ibsen commented on CAMEL-24075:
-------------------------------------

Merged via https://github.com/apache/camel/pull/24733

> camel-jms: transferException=true silently swallows processing failures (and commits the transaction) when the message has no JMSReplyTo
> ----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-24075
>                 URL: https://issues.apache.org/jira/browse/CAMEL-24075
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jms
>    Affects Versions: 4.21.0
>            Reporter: Federico Mariani
>            Assignee: Claus Ibsen
>            Priority: Major
>              Labels: code-review
>             Fix For: 4.22.0
>
>         Attachments: JmsTransferExceptionTransactedLostMessageTest.java
>
>
> h3. Problem
> {{EndpointMessageListener.evaluateExchangeResult()}} (EndpointMessageListener.java:216) returns {{null}} for a failed exchange whenever {{endpoint.isTransferException()}} is true - unconditionally, without checking whether a reply can actually be sent. {{handleReplyIfNeeded()}} then early-returns because {{sendReply}} is false (no {{JMSReplyTo}} on the message, or {{disableReplyTo=true}}, or the reply-to-self guard). Net effect: no {{RuntimeCamelException}} is thrown from {{onMessage}}, no reply is sent, the error handler is never invoked, and under {{transacted=true}} the session *commits*. The failure is completely invisible and the message is lost.
> h3. Failure scenario
> Endpoint {{jms:queue:orders?transferException=true&transacted=true}} (configured for request/reply); a client sends a fire-and-forget message without {{JMSReplyTo}}; the route throws; the transaction commits, nothing is logged, message gone.
> h3. History
> The logic dates to CAMEL-585 (Camel 1.x/2.x); the Jan-2026 listener refactor preserved it faithfully. {{JmsTransferExceptionIT}} only covers the request/reply case - no test pins the no-JMSReplyTo case.
> h3. Suggested fix direction
> Only suppress the exception when a reply will actually be sent (i.e. make the {{transferException}} branch conditional on {{sendReply}}); otherwise fall through to the normal rethrow so rollback/redelivery happens.
> h3. Reproducer
> Attached {{JmsTransferExceptionTransactedLostMessageTest.java}} (place in {{components/camel-jms/src/test/java/org/apache/camel/component/jms/}}). The control test (same route without {{transferException}}) passes - rollback and redelivery happen; the {{transferException}} variant is invoked exactly once and the message is gone. Uses the Artemis test-infra VM broker.
> ----
> _This issue was researched and filed by Claude Code on behalf of [~croway] (GitHub: Croway), as part of a deep code review of camel-jms and camel-amqp. A failing JUnit reproducer is attached; it fails deterministically on current main (4.22.0-SNAPSHOT)._



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