Skip to content

Commit d8f7a42

Browse files
Test with ibm mq
There is still an issue with read messsage annotations
1 parent 85f300c commit d8f7a42

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

deps/amqp10_client/src/amqp10_client_session.erl

+2-1
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ filter_capability(V) when is_binary(V) ->
791791
filter_capability({T, _} = V) when is_atom(T) ->
792792
%% looks like an already tagged type, just pass it through
793793
V.
794-
794+
795795
% https://people.apache.org/~rgodfrey/amqp-1.0/apache-filters.html
796796
translate_legacy_amqp_headers_binding(LegacyHeaders) ->
797797
{map,
@@ -867,6 +867,7 @@ send_attach(Send, #{name := Name, role := RoleTuple} = Args, {FromPid, _},
867867
rcv_settle_mode = rcv_settle_mode(Args),
868868
target = Target,
869869
max_message_size = MaxMessageSize},
870+
ct:log("Attach frame ~p", [Attach]),
870871
ok = Send(Attach, State),
871872

872873
Ref = make_link_ref(Role, self(), OutHandle),

deps/amqp10_client/test/system_SUITE.erl

+18-17
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ all() ->
2424
{group, rabbitmq},
2525
{group, rabbitmq_strict},
2626
{group, activemq},
27-
% {group, ibmmq}
27+
{group, ibmmq},
2828
{group, activemq_no_anon},
2929
{group, mock}
3030
].
@@ -33,7 +33,10 @@ groups() ->
3333
[
3434
{rabbitmq, [], shared()},
3535
{activemq, [], shared()},
36-
{ibmmq, [], test()},
36+
{ibmmq, [], [
37+
open_close_connection,
38+
basic_roundtrip_ibmmq
39+
]},
3740
{rabbitmq_strict, [], [
3841
basic_roundtrip_tls,
3942
roundtrip_tls_global_config,
@@ -62,12 +65,6 @@ groups() ->
6265
]}
6366
].
6467

65-
test() ->
66-
[
67-
open_close_connection,
68-
basic_roundtrip
69-
].
70-
7168
shared() ->
7269
[
7370
open_close_connection,
@@ -350,7 +347,7 @@ basic_roundtrip_ibmmq(Config) ->
350347
Hostname = ?config(rmq_hostname, Config),
351348
Port = rabbit_ct_broker_helpers:get_node_config(Config, 0, tcp_port_amqp),
352349
OpenConf = #{address => Hostname, port => Port, sasl => ?config(sasl, Config)},
353-
roundtrip(OpenConf, [{body, <<"banana">>}, {destination, <<"DEV.QUEUE.1">>}]).
350+
roundtrip(OpenConf, [{body, <<"banana">>}, {destination, <<"DEV.QUEUE.3">>}]).
354351

355352
roundtrip(OpenConf) ->
356353
roundtrip(OpenConf, []).
@@ -361,7 +358,7 @@ roundtrip(OpenConf, Args) ->
361358
{ok, Connection} = amqp10_client:open_connection(OpenConf),
362359
{ok, Session} = amqp10_client:begin_session(Connection),
363360
ct:log("Session attached "),
364-
SenderAttachArgs = #{name => <<"banana-sender">>,
361+
SenderAttachArgs = #{name => <<"banana-sender:DEV.QUEUE.3">>,
365362
role => {sender, #{address => Destination,
366363
durable => unsettled_state,
367364
capabilities => <<"queue">>}},
@@ -376,12 +373,14 @@ roundtrip(OpenConf, Args) ->
376373
ct:log("Sender attached "),
377374

378375
Now = os:system_time(millisecond),
379-
Props = #{creation_time => Now,
380-
message_id => <<"my message ID">>,
381-
correlation_id => <<"my correlation ID">>,
376+
Props = #{content_encoding => <<"my content encoding">>,
382377
content_type => <<"my content type">>,
383-
content_encoding => <<"my content encoding">>,
384-
group_id => <<"my group ID">>},
378+
correlation_id => <<"my correlation ID">>,
379+
creation_time => Now,
380+
group_id => <<"my group ID">>,
381+
message_id => <<"my message ID">>,
382+
to => Destination
383+
},
385384
Msg0 = amqp10_msg:new(<<"my-tag">>, Body, true),
386385
Msg1 = amqp10_msg:set_application_properties(#{"a_key" => "a_value"}, Msg0),
387386
Msg2 = amqp10_msg:set_properties(Props, Msg1),
@@ -403,12 +402,14 @@ roundtrip(OpenConf, Args) ->
403402
properties => #{}
404403
},
405404
{ok, Receiver} = amqp10_client:attach_link(Session, ReceiverAttachArgs),
406-
{ok, OutMsg} = amqp10_client:get_msg(Receiver, 4 * 60_000),
405+
{ok, OutMsg} = amqp10_client:get_msg(Receiver, 4_000),
407406
ok = amqp10_client:end_session(Session),
408407
ok = amqp10_client:close_connection(Connection),
409408

410409
% ct:pal(?LOW_IMPORTANCE, "roundtrip message Out: ~tp~nIn: ~tp~n", [OutMsg, Msg]),
411-
?assertMatch(Props, amqp10_msg:properties(OutMsg)),
410+
ActualProps = amqp10_msg:properties(OutMsg),
411+
[ ?assertMatch(V, maps:get(K, ActualProps)) || K := V <- Props, K =/= creation_time],
412+
412413
?assertEqual(#{<<"a_key">> => <<"a_value">>}, amqp10_msg:application_properties(OutMsg)),
413414
?assertMatch(#{<<"x-key">> := <<"x-value">>,
414415
<<"x_key">> := <<"x_value">>}, amqp10_msg:message_annotations(OutMsg)),

0 commit comments

Comments
 (0)