Skip to content

Fix amqp091->amqp10 shovel with complex headers #13798

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deps/rabbitmq_shovel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dep_amqp10_client = git https://github.com/rabbitmq/rabbitmq-amqp1.0-client.git

LOCAL_DEPS = crypto

TEST_DEPS = rabbitmq_ct_helpers rabbitmq_ct_client_helpers rabbitmq_amqp1_0 meck
TEST_DEPS = rabbitmq_ct_helpers rabbitmq_ct_client_helpers rabbitmq_amqp1_0 rabbitmq_amqp_client meck

PLT_APPS += rabbitmq_cli

Expand Down
2 changes: 0 additions & 2 deletions deps/rabbitmq_shovel/src/rabbit_amqp10_shovel.erl
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,4 @@ bin_to_hex(Bin) ->
is_amqp10_compat(T) ->
is_binary(T) orelse
is_number(T) orelse
%% TODO: not all lists are compatible
is_list(T) orelse
is_boolean(T).
26 changes: 25 additions & 1 deletion deps/rabbitmq_shovel/test/amqp10_dynamic_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ groups() ->
autodelete_amqp091_dest_on_confirm,
autodelete_amqp091_dest_on_publish,
simple_amqp10_dest,
simple_amqp10_src
simple_amqp10_src,
amqp091_to_amqp10_with_dead_lettering
]},
{with_map_config, [], [
simple,
Expand Down Expand Up @@ -96,6 +97,29 @@ simple_amqp10_dest(Config) ->
<<"src-queue">>)
end).

amqp091_to_amqp10_with_dead_lettering(Config) ->
Dest = ?config(destq, Config),
Src = ?config(srcq, Config),
TmpQ = <<"tmp">>,
with_session(Config,
fun (Sess) ->
{ok, LinkPair} = rabbitmq_amqp_client:attach_management_link_pair_sync(Sess, <<"my link pair">>),
{ok, _} = rabbitmq_amqp_client:declare_queue(LinkPair, TmpQ,
#{arguments =>#{<<"x-max-length">> => {uint, 0},
<<"x-dead-letter-exchange">> => {utf8, <<"">>},
<<"x-dead-letter-routing-key">> => {utf8, Src}}}),
{ok, Sender} = amqp10_client:attach_sender_link(Sess,
<<"sender-tmp">>,
<<"/queues/", TmpQ/binary>>,
unsettled,
unsettled_state),
ok = await_amqp10_event(link, Sender, attached),
expect_empty(Sess, TmpQ),
test_amqp10_destination(Config, Src, Dest, Sess, <<"amqp091">>, <<"src-queue">>),
%% publish to tmp, it should be dead-lettered to src and then shovelled to dest
_ = publish_expect(Sess, TmpQ, Dest, <<"tag1">>, <<"hello">>)
end).

test_amqp10_destination(Config, Src, Dest, Sess, Protocol, ProtocolSrc) ->
MapConfig = ?config(map_config, Config),
shovel_test_utils:set_param(Config, <<"test">>,
Expand Down