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

   # Description
   
   Fix two integration tests broken by CAMEL-23676 (`camel-nats - Only send 
reply when exchange pattern is InOut`).
   
   That commit changed `NatsConsumer` to only publish a reply to 
`msg.getReplyTo()` when `exchange.getPattern().isOutCapable()`. Since 
`NatsEndpoint` defaults to `InOnly`, consumer exchanges are `InOnly` by default 
and the reply is never published unless the endpoint URI explicitly sets 
`exchangePattern=InOut`.
   
   Both failing tests use `template.requestBody(...)`, which creates an `InOut` 
exchange on the producer side. The NATS producer therefore calls 
`connection.request()`, attaching a reply-to inbox to the message. The consumer 
receives the message, but because its exchange is `InOnly`, the 
`isOutCapable()` check fails and the reply is never sent. The producer then 
blocks until the 20-second `requestTimeout` fires, causing the test to fail 
with an `ExchangeTimedOutException`.
   
   Changes:
   
   - `NatsProducerReplyToIT`: add `?exchangePattern=InOut` to the consumer 
route URI so the consumer creates `InOut` exchanges and the reply is published 
back to the producer.
   - `NatsConsumerWithRedeliveryIT`: switch from `template.requestBody(...)` to 
`template.sendBody(...)`. The test only checks that messages reach 
`mock:result` and `mock:exception`; it never inspects the reply value. Using 
`sendBody` creates an `InOnly` exchange, so the NATS producer calls 
`connection.publish()` (no reply-to) and the consumer processes the message 
without needing to reply.
   
   This pattern is consistent with `NatsConsumerReplyToIT` and 
`NatsConsumerReplyToInOnlyIT` introduced by CAMEL-23676 to demonstrate correct 
usage of the new behavior.
   
   _Claude Code on behalf of Adriano Machado_
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # Tracking
   - [x] If this is a large change, bug fix, or code improvement, I checked 
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL-23676) 
filed for the change (usually before you start working on it).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   - [x] I have run `mvn clean install -DskipTests` locally from root folder 
and I have committed all auto-generated changes.


-- 
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