The Set Header EIP defines or modifies the message header.
Parameter | Description | Default value | Type |
|---|---|---|---|
| Name | Name of the message header that will be set. | String | |
| Expression | Defines the value that will be set in the header. It is mandatory and can use various supported expression languages, such as Simple, XPath, JSONPath. | ExpressionDefinition |
The expression allows you to calculate or dynamically define values during message processing in the integration flow. It is a way to configure behaviors that can vary according to the context of the message in transit.
The expression is organized into two hierarchical levels that allow the structure to be more extensible and adaptable to different contexts:
First level: specifies the type of logic that will be applied (constant, simple, jsonpath, etc.).
Second level: defines the actual value of the expression, that is, the data that will be assigned to the header.
constant: defines a fixed value.
In the example, it will always return "400".simple: allows you to use placeholders and simple logic to access message data.
In the example, it returns the value of the operacao header.jsonpath: extracts information from messages with JSON body.
In the example, it returns the value of the token field inside the data object.xpath: extracts information from messages with XML body.
In the example, it returns the id attribute of the customer node inside order.groovy/javascript/python (or another scripting language): uses custom scripts for complex operations.
In the example, the expression checks the length of the message body.
If the message body contains data, it sets the header as Valid; if it is empty, it sets it as Invalid.
It uses Groovy to perform this check conditionally.Content-Type.expression parameter is configured as constant, meaning it will have a fixed value.
This value will always be application/json, indicating that the request body will be in JSON format.We use cookies to enhance your experience on our site. By continuing to browse, you agree to our use of cookies.Learn more