Set Header

The SetHeader EIP allows you to set and header on your exchange.

Options

The Set Header EIP supports 1 options which are listed below:

Name Description Default Type

name

Required Name of message header to set a new value The simple language can be used to define a dynamic evaluated header name to be used. Otherwise a constant name will be used.

String

Examples

The following example shows how to use the SetHeader EIP

RouteBuilder builder = new RouteBuilder() {
    public void configure() {
        from("direct:a")
            .setHeader("myHeader", constant("test"))
            .to("direct:b");
    }
};

And the same example using XML:

<camelContext xmlns="http://camel.apache.org/schema/spring">
    <route>
        <from uri="direct:a"/>
        <setHeader name="myHeader">
            <constant>test</constant>
        </setHeader>
        <to uri="direct:b"/>
    </route>
</camelContext>