Edit this page

When receiving messages from external systems or sending messages to external systems, the external headers of the messages can be mapped to and from Ditto protocol headers.

That way the headers can be passed through Ditto, or defined Ditto protocol headers like for example correlation-id may be mapped to a header used for message correlation in the external system.

A header mapping can be defined individually for every source and target of a connection. For examples of a definition see source header mapping and target header mapping.

Supported placeholders

The supported placeholders for header mapping are defined in the Placeholders - Scope: Connections section. If a placeholder fails to resolve for a header value, then that header is not set. Placeholder resolution failure does not prevent sending of the message or setting other headers with resolved values.

Special header mapping keys

In addition to general header mapping capabilities, Ditto recognizes several special header mapping keys that control connectivity behavior:

Response diversion headers

These headers control response diversion functionality:

Header Key Description Example Values
divert-response-to-connection Target connection ID for response diversion "target-connection-id", "target-connection-id"
divert-expected-response-types Response types to divert (comma-separated) "response", "error", "nack"
diverted-response-from-connection Source connection of diverted response (automatically set) "source-connection-id"

Example source configuration with response diversion:

{
  "headerMapping": {
    "divert-response-to-connection": "webhook-connection",
    "divert-expected-response-types": "response,error",
    "device-id": "{{ header:device_id }}"
  }
}

Protocol-specific headers

Different protocols support different sets of headers. Some protocols also have special header behavior:

Tags: connectivity