davsclaus opened a new pull request, #23739:
URL: https://github.com/apache/camel/pull/23739

   ## Summary
   
   The NATS consumer unconditionally published the exchange body back to the 
NATS `replyTo` subject after route processing, regardless of the exchange 
pattern. Setting `exchangePattern=InOnly` had no effect — the body was still 
sent back.
   
   This caused `TypeConversionException` and NATS payload-size-exceeded errors 
when the route body was not suitable for reply (e.g. a `java.io.File` or large 
intermediate data).
   
   **Root cause:** The reply logic in `NatsConsumer` only checked 
`replyToDisabled`, `msg.getReplyTo()`, and connection availability — but never 
checked `exchange.getPattern().isOutCapable()`. This has been present since the 
reply-to feature was added in CAMEL-14252 (2019).
   
   **Fix:**
   - Auto-set the exchange pattern to `InOut` when the incoming NATS message 
has a `replyTo` subject (matching JMS and Spring-RabbitMQ behavior), so 
request/reply works by default
   - Gate the reply publishing on `exchange.getPattern().isOutCapable()`, so 
users can override with `exchangePattern=InOnly` to suppress replies
   - Added integration test verifying that `InOnly` consumers do not send 
replies
   
   Fixes: https://issues.apache.org/jira/browse/CAMEL-23676
   
   _Claude Code on behalf of Claus Ibsen_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to