CAMEL-23676: Fix NatsProducerReplyToIT and NatsConsumerWithRedeliveryIT tests#23811
Merged
Conversation
Both tests broke after CAMEL-23676 changed NatsConsumer to only publish a reply when the exchange pattern is InOut. - NatsProducerReplyToIT: add ?exchangePattern=InOut to the consumer URI so the consumer creates InOut exchanges and publishes the reply. - NatsConsumerWithRedeliveryIT: switch from requestBody to sendBody since the test only asserts mock delivery, not reply content. This avoids the request/reply handshake entirely. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Open
4 tasks
NatsProducerReplyToIT and NatsConsumerWithRedeliveryIT tests
davsclaus
approved these changes
Jun 7, 2026
Contributor
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
Contributor
|
🧪 CI tested the following changed modules:
All tested modules (8 modules)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fix two integration tests broken by CAMEL-23676 (
camel-nats - Only send reply when exchange pattern is InOut).That commit changed
NatsConsumerto only publish a reply tomsg.getReplyTo()whenexchange.getPattern().isOutCapable(). SinceNatsEndpointdefaults toInOnly, consumer exchanges areInOnlyby default and the reply is never published unless the endpoint URI explicitly setsexchangePattern=InOut.Both failing tests use
template.requestBody(...), which creates anInOutexchange on the producer side. The NATS producer therefore callsconnection.request(), attaching a reply-to inbox to the message. The consumer receives the message, but because its exchange isInOnly, theisOutCapable()check fails and the reply is never sent. The producer then blocks until the 20-secondrequestTimeoutfires, causing the test to fail with anExchangeTimedOutException.Changes:
NatsProducerReplyToIT: add?exchangePattern=InOutto the consumer route URI so the consumer createsInOutexchanges and the reply is published back to the producer.NatsConsumerWithRedeliveryIT: switch fromtemplate.requestBody(...)totemplate.sendBody(...). The test only checks that messages reachmock:resultandmock:exception; it never inspects the reply value. UsingsendBodycreates anInOnlyexchange, so the NATS producer callsconnection.publish()(no reply-to) and the consumer processes the message without needing to reply.This pattern is consistent with
NatsConsumerReplyToITandNatsConsumerReplyToInOnlyITintroduced by CAMEL-23676 to demonstrate correct usage of the new behavior.Claude Code on behalf of Adriano Machado
Target
mainbranch)Tracking
Apache Camel coding standards and style
mvn clean install -DskipTestslocally from root folder and I have committed all auto-generated changes.