Insert Header Action
Provided by: "Apache Software Foundation"
Support Level for this Kamelet is: "Stable"
Adds a header to each message, or replaces it, with a fixed text or a value taken from the message.
Use it to give a sink the headers it reads, such as the ce-projectKey header of jira-add-issue-sink, to tag messages with where they come from, or to copy the body into a header for a later step. To set the key of a Kafka record, set-kafka-key-action is simpler.
Input: any message.
Output: the same body. The header named by name is set to value, and replaces a header of the same name.
Good to know: value is written in the Camel Simple language: plain text is used as it is, and the ${…} parts are filled in from the message, such as ${body} for the body, or ${header.source} for the value of the header source.
Configuration Options
The following table summarizes the configuration options available for the insert-header-action Kamelet:
| Property | Name | Description | Type | Default | Example |
|---|---|---|---|---|---|
Header Name | Required The name of the header to set, such as | string | source | ||
Header Value | Required The value of the header: plain text, such as | string | ${header.customerId} |
Dependencies
At runtime, the insert-header-action Kamelet relies upon the presence of the following dependencies:
-
camel:kamelet
Camel JBang usage
Prerequisites
-
You’ve installed JBang.
-
You have executed the following command:
jbang app install camel@apache/camel Supposing you have a file named route.yaml with this content:
- route:
from:
uri: "kamelet:timer-source"
parameters:
period: 10000
message: 'test'
steps:
- to:
uri: "kamelet:insert-header-action"
parameters:
.
.
.
- to:
uri: "kamelet:log-sink" You can now run it directly through the following command
camel run route.yaml