Skip to content
This repository was archived by the owner on Nov 18, 2020. It is now read-only.

Commit 74a5838

Browse files
committed
Add cuttlefish config and test
1 parent f09fcc9 commit 74a5838

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ define PROJECT_ENV
88
[{login, <<"guest">>},
99
{passcode, <<"guest">>}]},
1010
{default_vhost, <<"/">>},
11+
{default_topic_exchange, <<"amq.topic">>},
1112
{ssl_cert_login, false},
1213
{implicit_connect, false},
1314
{tcp_listeners, [61613]},

priv/schema/rabbitmq_stomp.schema

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,15 @@ end}.
185185
{datatype, string}
186186
]}.
187187

188+
{mapping, "stomp.default_topic_exchange", "rabbitmq_stomp.default_topic_exchange", [
189+
{datatype, string}
190+
]}.
191+
192+
{translation, "rabbitmq_stomp.default_topic_exchange",
193+
fun(Conf) ->
194+
list_to_binary(cuttlefish:conf_get("stomp.default_topic_exchange", Conf, "amq.topic"))
195+
end}.
196+
188197
%% If a default user is configured, or you have configured use SSL client
189198
%% certificate based authentication, you can choose to allow clients to
190199
%% omit the CONNECT frame entirely. If set to true, the client is

src/rabbit_stomp_processor.erl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,19 +1186,19 @@ additional_info(Key,
11861186
proplists:get_value(Key, AddInfo).
11871187

11881188
maybe_apply_default_topic_exchange("amq.topic"=Exchange) ->
1189-
FromConfig = application:get_env(rabbitmq_stomp, default_topic_exchange, "amq.topic"),
1189+
FromConfig = application:get_env(rabbitmq_stomp, default_topic_exchange, <<"amq.topic">>),
11901190
maybe_apply_default_topic_exchange(Exchange, FromConfig);
11911191
maybe_apply_default_topic_exchange(Exchange) ->
11921192
Exchange.
11931193

1194-
maybe_apply_default_topic_exchange("amq.topic"=Exchange, "amq.topic") ->
1194+
maybe_apply_default_topic_exchange("amq.topic"=Exchange, <<"amq.topic">>) ->
11951195
%% This is the case where the destination is the same
11961196
%% as the default of amq.topic
11971197
Exchange;
11981198
maybe_apply_default_topic_exchange("amq.topic", FromConfig) ->
11991199
%% This is the case where the destination would have been
12001200
%% amq.topic but we have configured a different default
1201-
FromConfig;
1201+
binary_to_list(FromConfig);
12021202
maybe_apply_default_topic_exchange(Exchange, _FromConfig) ->
12031203
%% This is the case where the destination is different than
12041204
%% amq.topic, so it must have been specified in the

test/config_schema_SUITE_data/rabbitmq_stomp.snippets

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,9 @@
8484
{default_vhost,
8585
"stomp.default_vhost = /",
8686
[{rabbitmq_stomp,[{default_vhost,<<"/">>}]}],
87-
[rabbitmq_stomp]}].
87+
[rabbitmq_stomp]},
88+
{default_topic_exchange,
89+
"stomp.default_topic_exchange = my.fancy.topic",
90+
[{rabbitmq_stomp,[{default_topic_exchange,<<"my.fancy.topic">>}]}],
91+
[rabbitmq_stomp]}
92+
].

0 commit comments

Comments
 (0)