@@ -170,36 +170,29 @@ mqtt_amqpl_mqtt(Config) ->
170170 ok = emqtt :disconnect (C ).
171171
172172amqpl_mqtt_gh_12707 (Config ) ->
173- Q = ClientId = atom_to_binary (? FUNCTION_NAME ),
174- Ch = rabbit_ct_client_helpers :open_channel (Config ),
175- # 'queue.declare_ok' {} = amqp_channel :call (Ch , # 'queue.declare' {queue = Q , durable = true }),
176- # 'queue.bind_ok' {} = amqp_channel :call (Ch , # 'queue.bind' {queue = Q ,
177- exchange = <<" amq.topic" >>,
178- routing_key = <<" gh12707" >>}),
173+ ClientId = atom_to_binary (? FUNCTION_NAME ),
174+ Topic = Payload = <<" gh_12707" >>,
179175 C = connect (ClientId , Config ),
176+ {ok , _ , [1 ]} = emqtt :subscribe (C , Topic , qos1 ),
180177
181- Topic = <<" gh12707" >>,
182- Payload = <<" gh_12707" >>,
183-
184- {ok , _ , [1 ]} = emqtt :subscribe (C , #{'Subscription-Identifier' => 676 }, [{Topic , [{qos , 1 }]}]),
185- amqp_channel :call (Ch , # 'basic.publish' {exchange = <<" amq.topic" >>,
186- routing_key = Topic },
187- # amqp_msg {payload = Payload ,
188- props = # 'P_basic' {content_type = <<" application/json" >>,
189- expiration = <<" 12707" >>,
190- headers = []}}),
178+ Ch = rabbit_ct_client_helpers :open_channel (Config ),
179+ amqp_channel :call (Ch ,
180+ # 'basic.publish' {exchange = <<" amq.topic" >>,
181+ routing_key = Topic },
182+ # amqp_msg {payload = Payload ,
183+ props = # 'P_basic' {expiration = <<" 12707" >>,
184+ headers = []}}),
191185
192186 receive {publish ,
193- #{topic := MqttTopic ,
194- payload := MqttPayload }} ->
195- ? assertEqual (MqttTopic , Topic ),
196- ? assertEqual (Payload , MqttPayload )
197- after 1000 ->
198- ct :fail (" did not receive a delivery" )
187+ #{topic := MqttTopic ,
188+ payload := MqttPayload }} ->
189+ ? assertEqual (Topic , MqttTopic ),
190+ ? assertEqual (Payload , MqttPayload )
191+ after 5000 ->
192+ ct :fail (" did not receive a delivery" )
199193 end ,
200194
201- amqp_channel :call (Ch , # 'queue.delete' {queue = Q }),
202- rabbit_ct_client_helpers :close_channel (Ch ),
195+ ok = rabbit_ct_client_helpers :close_channel (Ch ),
203196 ok = emqtt :disconnect (C ).
204197
205198mqtt_amqp_mqtt (Config ) ->
0 commit comments