Fix modified annotations

```
<field name="message-annotations" type="fields"/>
```

Prior to this commit integration tests succeeded because both Erlang
client and RabbitMQ server contained a bug.

This bug was noticed by a Java client test suite.
This commit is contained in:
David Ansari 2024-09-18 09:38:44 +02:00
parent c593d706cd
commit cd600bef8b
2 changed files with 13 additions and 14 deletions

View File

@ -1171,16 +1171,13 @@ make_link_ref(Role, Session, Handle) ->
#link_ref{role = Role, session = Session, link_handle = Handle}.
translate_message_annotations(MA)
when is_map(MA) andalso
map_size(MA) > 0 ->
Content = maps:fold(fun (K, V, Acc) ->
when map_size(MA) > 0 ->
{map, maps:fold(fun(K, V, Acc) ->
[{sym(K), wrap_map_value(V)} | Acc]
end, [], MA),
#'v1_0.message_annotations'{content = Content};
end, [], MA)};
translate_message_annotations(_MA) ->
undefined.
wrap_map_value(true) ->
{boolean, true};
wrap_map_value(false) ->

View File

@ -1912,13 +1912,15 @@ settle_op_from_outcome(#'v1_0.modified'{delivery_failed = DelFailed,
undeliverable_here = UndelHere,
message_annotations = Anns0}) ->
Anns = case Anns0 of
#'v1_0.message_annotations'{content = C} ->
Anns1 = lists:map(fun({{symbol, K}, V}) ->
undefined ->
#{};
{map, KVList} ->
Anns1 = lists:map(
%% "all symbolic keys except those beginning with "x-" are reserved." [3.2.10]
fun({{symbol, <<"x-", _/binary>> = K}, V}) ->
{K, unwrap(V)}
end, C),
maps:from_list(Anns1);
_ ->
#{}
end, KVList),
maps:from_list(Anns1)
end,
{modify,
default(DelFailed, false),