Skip to content

CAMEL-23516: camel-xmpp - Use dedicated HeaderFilterStrategy aligned with sibling components#23283

Merged
oscerd merged 1 commit into
apache:mainfrom
oscerd:fix/CAMEL-23516
May 18, 2026
Merged

CAMEL-23516: camel-xmpp - Use dedicated HeaderFilterStrategy aligned with sibling components#23283
oscerd merged 1 commit into
apache:mainfrom
oscerd:fix/CAMEL-23516

Conversation

@oscerd
Copy link
Copy Markdown
Contributor

@oscerd oscerd commented May 18, 2026

Summary

camel-xmpp defaulted its headerFilterStrategy to a bare
new DefaultHeaderFilterStrategy() with no configuration — at
XmppEndpoint.java:106 (the production path, passed into XmppBinding)
and in the XmppBinding() no-arg constructor. The base strategy with no
inFilter / inFilterPattern / inFilterStartsWith returns false for
every header, so inbound XMPP message properties (XmppBinding.extractHeadersFrom,
applyFilterToExternalHeaders) are copied onto the Camel Exchange
as-is — including Camel* / camel* / org.apache.camel.* keys that
drive component behaviour downstream.

This aligns camel-xmpp with the rest of the component catalog
(camel-kafka, camel-mail, camel-coap, camel-google-pubsub,
camel-jms, camel-sjms, and camel-nats via CAMEL-23515) which all
ship a dedicated HeaderFilterStrategy subclass.

Changes

  • New XmppHeaderFilterStrategy following the
    KafkaHeaderFilterStrategy / MailHeaderFilterStrategy shape
    (setLowerCase(true), in/out setInFilterStartsWith(CAMEL_FILTER_STARTS_WITH)).
  • XmppEndpoint and the XmppBinding no-arg constructor now default to
    new XmppHeaderFilterStrategy(); the now-unused
    DefaultHeaderFilterStrategy import is removed from both
    (XmppHeaderFilterStrategy is in the same package).
  • Unit test covering inbound/outbound Camel* filtering, lowercase
    variants, and pass-through of non-Camel headers.
  • 4.21 upgrade-guide entry (=== camel-xmpp).

Test plan

  • Module build: mvn -pl components/camel-xmpp -DskipTests install
  • New unit test: XmppHeaderFilterStrategyTest (4 tests, green)
  • CI: full reactor build + existing camel-xmpp suite

JIRA

https://issues.apache.org/jira/browse/CAMEL-23516

Sibling of CAMEL-23515 (camel-nats, merged to main/4.18.x/4.14.x).
Backports to 4.18.x and 4.14.x planned per the fixVersions.

Claude Code on behalf of Andrea Cosentino

…with sibling components

Introduce XmppHeaderFilterStrategy following the KafkaHeaderFilterStrategy /
MailHeaderFilterStrategy shape (lowerCase=true, filter headers starting with
Camel/camel/org.apache.camel. in both directions), and switch the defaults in
XmppEndpoint and the XmppBinding no-arg constructor to use it.

Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
@oscerd oscerd requested review from davsclaus and gnodet May 18, 2026 08:38
@github-actions
Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@github-actions
Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • components/camel-xmpp
  • docs

⚠️ Some tests are disabled on GitHub Actions (@DisabledIfSystemProperty(named = "ci.env.name")) and require manual verification:

  • components/camel-xmpp: 6 test(s) disabled on GitHub Actions
All tested modules (8 modules)
  • Camel :: JBang :: MCP
  • Camel :: JBang :: Plugin :: Route Parser
  • Camel :: JBang :: Plugin :: TUI
  • Camel :: JBang :: Plugin :: Validate
  • Camel :: Launcher :: Container
  • Camel :: XMPP
  • Camel :: YAML DSL :: Validator
  • Camel :: YAML DSL :: Validator Maven Plugin

⚙️ View full build and test results

@oscerd oscerd merged commit 4a07498 into apache:main May 18, 2026
7 checks passed
@oscerd oscerd deleted the fix/CAMEL-23516 branch May 18, 2026 10:04
oscerd added a commit that referenced this pull request May 19, 2026
…with sibling components (#23296)

camel-xmpp defaulted its headerFilterStrategy to a bare
DefaultHeaderFilterStrategy (XmppEndpoint and the XmppBinding no-arg
constructor), passing inbound XMPP message properties — including
Camel* / camel* / org.apache.camel.* — straight onto the Exchange.
Introduces XmppHeaderFilterStrategy (KafkaHeaderFilterStrategy /
MailHeaderFilterStrategy shape) and switches both defaults to it,
aligning camel-xmpp with the rest of the component catalog. Includes a
unit test and the 4.21 upgrade-guide entry. Sibling of CAMEL-23515
(camel-nats). Follow-up to evaluate centralizing this in
DefaultHeaderFilterStrategy is tracked as CAMEL-23543.

Closes #23283

(cherry picked from commit 4a07498)
oscerd added a commit that referenced this pull request May 19, 2026
…rFilterStrategy aligned with sibling components

Backport of #23283 onto camel-4.14.x. camel-xmpp defaulted its
headerFilterStrategy to a bare DefaultHeaderFilterStrategy (XmppEndpoint
and the XmppBinding no-arg constructor), passing inbound XMPP message
properties — including Camel* / camel* / org.apache.camel.* — onto the
Exchange. Introduces XmppHeaderFilterStrategy (KafkaHeaderFilterStrategy
/ MailHeaderFilterStrategy shape) and switches both defaults to it.
Includes a unit test and the camel-4x-upgrade-guide-4_14.adoc note.

(cherry picked from commit 4a07498)

JIRA: https://issues.apache.org/jira/browse/CAMEL-23516

Closes #23321
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants