Skip to content

Commit

Permalink
Add documentation about AMQP message annotation header mapping
Browse files Browse the repository at this point in the history
Co-authored-by: Stanchev Aleksandar <aleksandar.stanchev@bosch.io>
Signed-off-by: David Schwilk <david.schwilk@bosch.io>
  • Loading branch information
DerSchwilk and Stanchev Aleksandar committed Oct 6, 2022
1 parent b55f186 commit d996447
Showing 1 changed file with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ application/vnd.eclipse.ditto+json
If messages, which are not in Ditto Protocol, should be processed, a [payload mapping](connectivity-mapping.html) must
be configured for the AMQP 1.0 connection in order to transform the messages.

## AMQP 1.0 properties and application properties
## AMQP 1.0 properties, application properties and message annotations

When set as external headers by outgoing payload or header mapping, the properties defined by AMQP 1.0 specification are
set to the corresponding header value. Conversely, the values of AMQP 1.0 properties are available for incoming payload
Expand Down Expand Up @@ -62,6 +62,28 @@ the Ditto protocol header `reply-to` to the value of the application property `t
}
```

To set a message annotation, prefix it by `amqp.message.annotation:`.
The following [target header mapping](basic-connections.html#target-header-mapping) sets
the message annotation `to` to the value of the Ditto protocol header `reply-to`:
```json
{
"headerMapping": {
"amqp.message.annotation:to": "{%raw%}{{ header:reply-to }}{%endraw%}"
}
}
```

To read a message annotation whose name is identical to an AMQP 1.0 property, prefix it by `amqp.message.
annotation:`. The following [source header mapping](basic-connections.html#source-header-mapping) sets
the Ditto protocol header `reply-to` to the value of the message annotation `to`:
```json
{
"headerMapping": {
"reply-to": "{%raw%}{{ header:amqp.message.annotation:to }}{%endraw%}"
}
}
```

{% include note.html content="For now, setting or reading the AMQP 1.0 property 'content-encoding' is impossible." %}

## Specific connection configuration
Expand Down

0 comments on commit d996447

Please sign in to comment.