CAMEL-23515: camel-nats - Use dedicated HeaderFilterStrategy aligned with sibling components#23233
Merged
Merged
Conversation
…with sibling components Introduce NatsHeaderFilterStrategy following the KafkaHeaderFilterStrategy / MailHeaderFilterStrategy shape (lowerCase=true, filter headers starting with Camel/camel/org.apache.camel. in both directions), and switch the default in NatsConfiguration to use it. Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
Contributor
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
davsclaus
approved these changes
May 14, 2026
Contributor
|
🧪 CI tested the following changed modules:
All tested modules (8 modules)
|
This was referenced May 15, 2026
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.
Summary
camel-natsdefaulted itsheaderFilterStrategyto a barenew DefaultHeaderFilterStrategy()with no further configuration(
NatsConfiguration.java:119). The base class with noinFilter/inFilterPattern/inFilterStartsWithconfigured returnsfalseforevery header, which means every inbound NATS message header is copied
onto the Camel
Exchangeas-is — includingCamel*/camel*/org.apache.camel.*keys that drive component behaviour downstream.Sibling components (camel-kafka, camel-mail, camel-coap,
camel-google-pubsub, camel-jms, camel-sjms, …) ship a dedicated subclass
that configures
setInFilterStartsWith("Camel", "camel", "org.apache.camel.")and
setLowerCase(true). This PR alignscamel-natswith thatconvention.
Changes
NatsHeaderFilterStrategyfollowing theKafkaHeaderFilterStrategy/MailHeaderFilterStrategyshape.NatsConfigurationnow defaultsheaderFilterStrategytonew NatsHeaderFilterStrategy().Camel*filtering, lowercasevariants, and pass-through of non-Camel headers.
=== camel-natssection.
Test plan
mvn -pl components/camel-nats -DskipTests installNatsHeaderFilterStrategyTest(4 assertions)JIRA
https://issues.apache.org/jira/browse/CAMEL-23515
Backports planned for 4.18.x and 4.14.x per
fixVersionson the JIRA.Claude Code on behalf of Andrea Cosentino