Skip to content

Commit

Permalink
Prefix message annotations
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 d996447 commit 63bbc57
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,7 @@ private static void readAmqpMessageAnnotationsFromMessage(final Message message,
wrap(msg -> {
facade.filterTracingAnnotations((key, value) -> {
if (value != null) {
final var headerName = isDefinedAmqpProperty(key)
? AMQP.MESSAGE_ANNOTATION_PREFIX + key
: key;
final var headerName = AMQP.MESSAGE_ANNOTATION_PREFIX + key;
headers.put(headerName, value.toString());
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ public void testPublishMessageWithAmqpProperties() throws Exception {
assertThat(receivedHeaders).containsEntry("amqp.application.property:to", "value1");
assertThat(receivedHeaders).containsEntry("anotherApplicationProperty", "value2");
// group-sequence is an AMQP prop of type "int", therefore it must not be contained in the headers here
assertThat(receivedHeaders).containsEntry("message-annotation", "value3");
assertThat(receivedHeaders).containsEntry("amqp.message.annotation:message-annotation", "value3");
assertThat(receivedHeaders).doesNotContainKey("group-sequence");
}};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ the message annotation `to` to the value of the Ditto protocol header `reply-to`
}
```

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
To read a message annotation, 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
{
Expand Down

0 comments on commit 63bbc57

Please sign in to comment.