@@ -28,6 +28,7 @@ groups() ->
28
28
publish_unauthorized_error ,
29
29
subscribe_error ,
30
30
subscribe ,
31
+ subscribe_with_x_priority ,
31
32
unsubscribe_ack ,
32
33
subscribe_ack ,
33
34
send ,
@@ -161,6 +162,42 @@ subscribe(Config) ->
161
162
{ok , _Client2 , _ , [<<" hello" >>]} = stomp_receive (Client1 , " MESSAGE" ),
162
163
ok .
163
164
165
+ subscribe_with_x_priority (Config ) ->
166
+ Version = ? config (version , Config ),
167
+ StompPort = rabbit_ct_broker_helpers :get_node_config (Config , 0 , tcp_port_stomp ),
168
+ Channel = ? config (amqp_channel , Config ),
169
+ ClientA = ? config (stomp_client , Config ),
170
+ # 'queue.declare_ok' {} =
171
+ amqp_channel :call (Channel , # 'queue.declare' {queue = ? QUEUE ,
172
+ durable = true ,
173
+ arguments = [{<<" x-queue-type" >>, longstr , <<" quorum" >>},
174
+ {<<" x-single-active-consumer" >>, bool , true }
175
+ ]}),
176
+
177
+ % % subscribe and wait for receipt
178
+ rabbit_stomp_client :send (
179
+ ClientA , " SUBSCRIBE" , [{" destination" , ? DESTINATION }, {" receipt" , " foo" }]),
180
+ {ok , _ClientA1 , _ , _ } = stomp_receive (ClientA , " RECEIPT" ),
181
+
182
+ % % subscribe with a higher priority and wait for receipt
183
+ {ok , ClientB } = rabbit_stomp_client :connect (Version , StompPort ),
184
+ rabbit_stomp_client :send (
185
+ ClientB , " SUBSCRIBE" , [{" destination" , ? DESTINATION },
186
+ {" receipt" , " foo" },
187
+ {" x-priority" , 10 }
188
+ ]),
189
+ {ok , ClientB1 , _ , _ } = stomp_receive (ClientB , " RECEIPT" ),
190
+
191
+ % % send from amqp
192
+ Method = # 'basic.publish' {exchange = <<" " >>, routing_key = ? QUEUE },
193
+
194
+ amqp_channel :call (Channel , Method , # amqp_msg {props = # 'P_basic' {},
195
+ payload = <<" hello" >>}),
196
+
197
+ % % ClientB should receive the message since it has a higher priority
198
+ {ok , _ClientB2 , _ , [<<" hello" >>]} = stomp_receive (ClientB1 , " MESSAGE" ),
199
+ ok .
200
+
164
201
unsubscribe_ack (Config ) ->
165
202
Channel = ? config (amqp_channel , Config ),
166
203
Client = ? config (stomp_client , Config ),
0 commit comments