Claus Ibsen created CAMEL-26152:
-----------------------------------
Summary: camel-sjms - an InOut reply that cannot be sent is
dropped silently and the message is acked, and jmsMessageType=Stream fails with
a NullPointerException
Key: CAMEL-26152
URL: https://issues.apache.org/jira/browse/CAMEL-26152
Project: Camel
Issue Type: Bug
Components: camel-sjms
Reporter: Claus Ibsen
Fix For: 4.24.0
Found while adding the catalog body types of sjms and sjms2 (CAMEL-24961, PR
#28394).
All three apply to camel-sjms2 too, as it inherits this code from camel-sjms.
h4. 1. An InOut reply that cannot be sent is dropped silently
When the reply body cannot be turned into a JMS message (an {{Integer}}, a
{{List}}, or a {{Serializable}} without {{objectMessageEnabled}}),
{{EndpointMessageListener.sendReply}} (main 2a465aa4814c, line 291) catches the
error and sets a {{CamelExchangeException}} on the exchange. {{onMessage}} then
only looks for a {{RuntimeCamelException}} (line 222), so nothing is rethrown:
the request is acked, no reply is sent and nothing is logged, and the caller
waits until its request timeout. Checked on 4.24.0-SNAPSHOT with an embedded
Artemis, InOut, in both modules.
Proposed: rethrow (or hand to the exception handler) any exception set by
{{sendReply}}, not only a {{RuntimeCamelException}}.
h4. 2. jmsMessageType=Stream fails with a NullPointerException on send
{{JmsBinding.createJmsMessageForType}} (line 528) has no case for
{{JmsMessageType.Stream}} and returns null (line 578); {{createJmsMessage}}
then calls {{answer.setJMSDeliveryMode(...)}} on null (line 471). Checked on
4.24.0-SNAPSHOT with an embedded Artemis.
Proposed: create a {{StreamMessage}} for {{Stream}} (or fail with a clear
message that the type is not supported), never return null.
h4. 3. A body that cannot be converted is sent as an empty message with only a
WARN
When no JMS message type fits the body (a non-Serializable POJO with no
converter to {{File}} or {{InputStream}}), {{JmsBinding.createJmsMessage}} logs
a WARN (line 482) and sends an empty {{jakarta.jms.Message}} (line 491). The
body is lost: the consumer receives null, and for a reply the caller gets null.
Checked on 4.24.0-SNAPSHOT with an embedded Artemis, producer and InOut reply.
Proposed: fail the exchange (as the {{Object}} case does when
{{objectMessageEnabled}} is false) instead of sending an empty message; send a
plain {{Message}} only for a null body.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)