See tutorials/operation/10-Correlation-Id.yaml.
Example Configuration
api:
port: 2000
flow:
- correlationId:
header: X-Trace-Id
default: "req-${T(java.util.UUID).randomUUID()}"
- log:
message: "Correlation id: ${request.header['X-Trace-Id']}"
api:
port: 2000
flow:
- correlationId:
header: X-Trace-Id
default: "req-${T(java.util.UUID).randomUUID()}"
- log:
message: "Correlation id: ${request.header['X-Trace-Id']}"
Syntax
correlationId:
'$ref': <string>
default: <string>
header: <string>
language: groovy
logField: <string>
xmlConfig: {}
correlationId:
'$ref': <string>
default: <string>
header: <string>
language: groovy
logField: <string>
xmlConfig: {}
Attributes
| Name | Required | Default | Description | Examples |
|---|---|---|---|---|
| $ref | false | - | Reference a component defined under components. | - |
| default | false | - | Expression used to generate a new correlation id when the header is absent. If omitted, a random UUID is generated. | - |
| header | false | X-Correlation-Id | Name of the HTTP request header that carries the correlation id. | - |
| language | false | SpEL | Scripting language used to evaluate the value expression. | SpEL | groovy | jsonpath | xpath |
| logField | false | correlationId | Name of the MDC variable the correlation id is stored under for logging. | - |
Child Structure
| Element | Cardinality | Description |
|---|---|---|
| xmlConfig | 0..1 | XML namespace declarations for XPath expressions in the value. |