Skip to content

Commit 968bfdd

Browse files
Merge pull request #13801 from rabbitmq/mergify/bp/v4.1.x/pr-13798
Fix amqp091->amqp10 shovel with complex headers (backport #13798)
2 parents d6f4a14 + 0ce72b4 commit 968bfdd

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

deps/rabbitmq_shovel/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ dep_amqp10_client = git https://github.com/rabbitmq/rabbitmq-amqp1.0-client.git
2323

2424
LOCAL_DEPS = crypto
2525

26-
TEST_DEPS = rabbitmq_ct_helpers rabbitmq_ct_client_helpers rabbitmq_amqp1_0 meck
26+
TEST_DEPS = rabbitmq_ct_helpers rabbitmq_ct_client_helpers rabbitmq_amqp1_0 rabbitmq_amqp_client meck
2727

2828
PLT_APPS += rabbitmq_cli
2929

deps/rabbitmq_shovel/src/rabbit_amqp10_shovel.erl

-2
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,4 @@ bin_to_hex(Bin) ->
445445
is_amqp10_compat(T) ->
446446
is_binary(T) orelse
447447
is_number(T) orelse
448-
%% TODO: not all lists are compatible
449-
is_list(T) orelse
450448
is_boolean(T).

deps/rabbitmq_shovel/test/amqp10_dynamic_SUITE.erl

+25-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ groups() ->
2727
autodelete_amqp091_dest_on_confirm,
2828
autodelete_amqp091_dest_on_publish,
2929
simple_amqp10_dest,
30-
simple_amqp10_src
30+
simple_amqp10_src,
31+
amqp091_to_amqp10_with_dead_lettering
3132
]},
3233
{with_map_config, [], [
3334
simple,
@@ -96,6 +97,29 @@ simple_amqp10_dest(Config) ->
9697
<<"src-queue">>)
9798
end).
9899

100+
amqp091_to_amqp10_with_dead_lettering(Config) ->
101+
Dest = ?config(destq, Config),
102+
Src = ?config(srcq, Config),
103+
TmpQ = <<"tmp">>,
104+
with_session(Config,
105+
fun (Sess) ->
106+
{ok, LinkPair} = rabbitmq_amqp_client:attach_management_link_pair_sync(Sess, <<"my link pair">>),
107+
{ok, _} = rabbitmq_amqp_client:declare_queue(LinkPair, TmpQ,
108+
#{arguments =>#{<<"x-max-length">> => {uint, 0},
109+
<<"x-dead-letter-exchange">> => {utf8, <<"">>},
110+
<<"x-dead-letter-routing-key">> => {utf8, Src}}}),
111+
{ok, Sender} = amqp10_client:attach_sender_link(Sess,
112+
<<"sender-tmp">>,
113+
<<"/queues/", TmpQ/binary>>,
114+
unsettled,
115+
unsettled_state),
116+
ok = await_amqp10_event(link, Sender, attached),
117+
expect_empty(Sess, TmpQ),
118+
test_amqp10_destination(Config, Src, Dest, Sess, <<"amqp091">>, <<"src-queue">>),
119+
%% publish to tmp, it should be dead-lettered to src and then shovelled to dest
120+
_ = publish_expect(Sess, TmpQ, Dest, <<"tag1">>, <<"hello">>)
121+
end).
122+
99123
test_amqp10_destination(Config, Src, Dest, Sess, Protocol, ProtocolSrc) ->
100124
MapConfig = ?config(map_config, Config),
101125
shovel_test_utils:set_param(Config, <<"test">>,

0 commit comments

Comments
 (0)