Skip to content
Open
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
5 changes: 5 additions & 0 deletions doc/configuration/outgoing-connections.md
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,11 @@ Any other `Tag` can be used for other purposes.
* **Default:** `"guest"`
* **Example:** `password = "guest"`

### `outgoing_pools.rabbit.*.connection.virtual_host`
* **Syntax:** string
* **Default:** `"/"`
* **Example:** `virtual_host = "host_example"`

### `outgoing_pools.rabbit.*.connection.confirms_enabled`
* **Syntax:** boolean
* **Default:** `false`
Expand Down
3 changes: 3 additions & 0 deletions src/config/mongoose_config_spec.erl
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,8 @@ outgoing_pool_connection(<<"rabbit">>) ->
validate = non_empty},
<<"password">> => #option{type = binary,
validate = non_empty},
<<"virtual_host">> => #option{type = binary,
validate = non_empty},
<<"confirms_enabled">> => #option{type = boolean},
<<"max_worker_queue_len">> => #option{type = int_or_infinity,
validate = non_negative}
Expand All @@ -543,6 +545,7 @@ outgoing_pool_connection(<<"rabbit">>) ->
<<"port">> => 5672,
<<"username">> => <<"guest">>,
<<"password">> => <<"guest">>,
<<"virtual_host">> => <<"/">>,
<<"confirms_enabled">> => false,
<<"max_worker_queue_len">> => 1000}
};
Expand Down
4 changes: 2 additions & 2 deletions src/mongoose_amqp.erl
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
%%%===================================================================

-spec network_params(map()) -> #amqp_params_network{}.
network_params(#{host := Host, port := Port, username := UserName, password := Password}) ->
#amqp_params_network{host = Host, port = Port, username = UserName, password = Password}.
network_params(#{host := Host, port := Port, username := UserName, password := Password, virtual_host := VirtualHost}) ->
#amqp_params_network{host = Host, port = Port, username = UserName, password = Password, virtual_host = VirtualHost}.

-spec exchange_declare(Exchange :: binary(), Type :: binary()) -> method().
exchange_declare(Exchange, Type) ->
Expand Down
1 change: 1 addition & 0 deletions test/common/config_parser_helper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,7 @@ default_pool_conn_opts(rabbit) ->
port => 5672,
username => <<"guest">>,
password => <<"guest">>,
virtual_host => <<"/">>,
confirms_enabled => false,
max_worker_queue_len => 1000};
default_pool_conn_opts(redis) ->
Expand Down
2 changes: 2 additions & 0 deletions test/config_parser_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1085,12 +1085,14 @@ pool_rabbit_connection(_Config) ->
?cfg(P ++ [port], 9999, T(#{<<"port">> => 9999})),
?cfg(P ++ [username], <<"user">>, T(#{<<"username">> => <<"user">>})),
?cfg(P ++ [password], <<"pass">>, T(#{<<"password">> => <<"pass">>})),
?cfg(P ++ [virtual_host], <<"vh">>, T(#{<<"virtual_host">> => <<"vh">>})),
?cfg(P ++ [confirms_enabled], true, T(#{<<"confirms_enabled">> => true})),
?cfg(P ++ [max_worker_queue_len], 100, T(#{<<"max_worker_queue_len">> => 100})),
?err(T(#{<<"host">> => <<>>})),
?err(T(#{<<"port">> => 123456})),
?err(T(#{<<"username">> => <<>>})),
?err(T(#{<<"password">> => <<>>})),
?err(T(#{<<"virtual_host">> => <<>>})),
?err(T(#{<<"confirms_enabled">> => <<"yes">>})),
?err(T(#{<<"max_worker_queue_len">> => -1})).

Expand Down