Skip to content

Fix #3240: sink and action Kamelets remove the component headers of the incoming message first - #3241

Open
davsclaus wants to merge 4 commits into
apache:mainfrom
davsclaus:ci-issue-3240
Open

davsclaus wants to merge 4 commits into
apache:mainfrom
davsclaus:ci-issue-3240

Conversation

@davsclaus

@davsclaus davsclaus commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #3240.

Each sink and action that calls a Camel component now removes the headers of that component as its first step, so a header that comes along with the message cannot change what the Kamelet was configured to do.

Changes

  • 92 Kamelets: a removeHeaders step with the prefix of the component (such as CamelAwsS3*, CamelJms*, CamelKafka*, CamelSmpp*, CamelSalesforce*) is the first step of the template, and a sentence in "Good to know" says so.
    • The steps of the template that set those headers on purpose, from options or from the file, key and similar headers, run after it and keep working.
    • Headers a Kamelet documents as input are kept with excludePattern, for example CamelSmppDestAddr, CamelAwsS3ContentType and CamelAwsS3StorageClass, CamelAwsDdbOperation, CamelPulsarProducerMessageKey, CamelCouchbaseId, CamelFileName for the FTP/SFTP/SCP sinks, and CamelKafkaKey and CamelKafkaOverrideTopic for the Kafka sinks (set by the key and router actions).
  • HTTP Kamelets: rest-openapi-sink, ogcapi-features-action and azure-functions-sink remove the CamelHttp* and CamelRestHttp* headers, as http-sink does.
  • azure-functions-sink: the key handling is the one of main (chore: the Azure Event Hubs, Cosmos DB and Functions Kamelets take more options (#3170) #3218): the code query parameter, or the x-functions-key header with keyInHeader=true. This PR only replaces its removeHeader: CamelHttpUri with the CamelHttp*/CamelRestHttp* strip.
  • Not changed: exec-sink and ssh-sink (they take the command from headers by design), the actions whose job is to set headers (Kafka router and key actions, insert-header-action, ...), and the Kamelets that already removed their headers before the call (SQL sinks, cassandra-sink, http-sink, mail-sink, aws-ec2-sink, aws-bedrock-agent-sink, docling-convert-action).

Rebased onto the #3170 option PRs

Tests

  • KameletsRemoveHeadersTest: for every changed Kamelet (table in remove-headers/kamelets.csv), the first step is the expected removeHeaders, and Message.removeHeaders with that pattern removes a header of the component and keeps the documented inputs.
  • HttpKameletsTargetTest: runs rest-openapi-sink, ogcapi-features-action and azure-functions-sink (with the key in the query, and with keyInHeader=true) against a local server, with CamelHttpUri, CamelHttpPath, CamelHttpQuery, CamelRestHttpUri and similar headers on the message, and checks that the request goes to the configured server, path and query. These tests fail on the templates of main.
  • ./mvnw clean install passes.

Upgrade

A flow that set such a header on purpose before a sink now has to use the option of the Kamelet, or call the Camel component directly. To be added to the upgrade notes (#3190).

Claude Code on behalf of Claus Ibsen

🤖 Generated with Claude Code

davsclaus and others added 2 commits November 18, 2026 22:43
…s of the incoming message first

Each sink and action that calls a component now removes the headers of
that component as its first step, so a header that comes with the
message cannot change the bucket, destination, operation or address the
Kamelet was configured with. The template's own setHeader steps run
after it, and the headers a Kamelet documents as input are kept.

- 88 Kamelets: removeHeaders with the component prefix, and a sentence
  in Good to know.
- rest-openapi-sink, ogcapi-features-action, azure-functions-sink remove
  the CamelHttp* and CamelRestHttp* headers, as http-sink does.
- azure-functions-sink sends the key in the x-functions-key header
  instead of the code query parameter.
- KameletsRemoveHeadersTest checks the first step of every changed
  Kamelet; HttpKameletsTargetTest runs the HTTP Kamelets against local
  servers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
…ers of the incoming message first

The Salesforce producer reads CamelSalesforceSObjectName, CamelSalesforceSObjectId
and similar headers ahead of the endpoint options; the component catalog lists only
its consumer headers, so the first scan missed these sinks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
davsclaus and others added 2 commits November 18, 2026 23:06
…(keyInHeader) and only strips the HTTP headers

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
…n (keyInHeader)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sink and action Kamelets: remove the component headers of the incoming message first, so the options decide what the Kamelet does

1 participant