Skip to content

Commit e4bc525

Browse files
authored
Merge pull request #14421 from rabbitmq/local-shovel-default-user-pass
Local shovels: Set default user/pass for uris like "amqp://"
2 parents 7be4189 + f990f7e commit e4bc525

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

deps/rabbitmq_shovel/src/rabbit_local_shovel.erl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,13 @@ get_user_vhost_from_amqp_param(Uri) ->
546546
#amqp_params_direct{username = U,
547547
password = P,
548548
virtual_host = V} ->
549-
{U, P, V};
549+
case {U, P} of
550+
{none, none} ->
551+
%% Default user for uris like amqp://
552+
{<<"guest">>, <<"guest">>, V};
553+
_ ->
554+
{U, P, V}
555+
end;
550556
#amqp_params_network{username = U,
551557
password = P,
552558
virtual_host = V} ->

deps/rabbitmq_shovel/test/local_dynamic_SUITE.erl

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ groups() ->
7676
local_to_local_quorum_credit_flow_no_ack,
7777
local_to_local_stream_credit_flow_on_confirm,
7878
local_to_local_stream_credit_flow_on_publish,
79-
local_to_local_stream_credit_flow_no_ack
79+
local_to_local_stream_credit_flow_no_ack,
80+
local_to_local_simple_uri
8081
]}
8182
].
8283

@@ -1029,6 +1030,21 @@ local_to_local_stream_credit_flow(Config, AckMode) ->
10291030
amqp10_client:detach_link(Receiver)
10301031
end).
10311032

1033+
local_to_local_simple_uri(Config) ->
1034+
Src = ?config(srcq, Config),
1035+
Dest = ?config(destq, Config),
1036+
AltVHost = ?config(alt_vhost, Config),
1037+
Uri = <<"amqp://">>,
1038+
ok = rabbit_ct_broker_helpers:rpc(
1039+
Config, 0, rabbit_runtime_parameters, set,
1040+
[<<"/">>, <<"shovel">>, ?PARAM, [{<<"src-uri">>, Uri},
1041+
{<<"dest-uri">>, [Uri]},
1042+
{<<"src-protocol">>, <<"local">>},
1043+
{<<"src-queue">>, Src},
1044+
{<<"dest-protocol">>, <<"local">>},
1045+
{<<"dest-queue">>, Dest}],
1046+
none]),
1047+
shovel_test_utils:await_shovel(Config, ?PARAM).
10321048

10331049
%%----------------------------------------------------------------------------
10341050
with_session(Config, Fun) ->

0 commit comments

Comments
 (0)