Correlation Identifier

Camel supports the Correlation Identifier from the EIP patterns by getting or setting a header on the Message.

When working with the JMS components, the correlation identifier header is called JMSCorrelationID, and they handle the correlation automatically.

Other messaging systems, such as Spring RabbitMQ, also handle this automatically. In general, you should not have a need for using custom correlation IDs with these systems.


You can use your own correlation identifier to any message exchange to help correlate messages together to a single conversation (or business process). For example, if you need to correlation messages when using web services.

The use of a correlation identifier is key to working with Distributed Tracing and be useful when using Tracer messages to log, or testing with simulation or canned data such as with the Mock testing framework.

EIPs using correlation identifiers

Some EIP patterns will spin off a sub message. In those cases, Camel will add a correlation id on the Exchange as a property with they key Exchange.CORRELATION_ID, which links back to the source Exchange and its exchange id.

The following EIPs does this:


The following example uses a request/reply pattern in the JMS component, where correlation identifiers are automatically handled:

  • Java

  • XML

  • YAML

    .to(ExchangePattern.InOut, "jms:queue:foo")
    <from uri="direct:start"/>
    <to pattern="InOut" uri="jms:queue:foo"/>
    <to uri="mock:result"/>
- from:
    uri: direct:start
      - to:
          uri: jms:queue:foo
          pattern: InOut
      - to:
          uri: mock:result