File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed
main/java/com/rabbitmq/client/amqp/impl
test/java/com/rabbitmq/client/amqp/impl Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -286,10 +286,13 @@ private void sync(NativeConnectionWrapper wrapper) {
286286 this .nativeConnection = wrapper .connection ();
287287 }
288288
289- private static void checkBroker (org .apache .qpid .protonj2 .client .Connection connection ) throws ClientException {
289+ private static void checkBroker (org .apache .qpid .protonj2 .client .Connection connection )
290+ throws ClientException {
290291 String broker = (String ) connection .properties ().get ("product" );
291292 if (!"rabbitmq" .equalsIgnoreCase (broker )) {
292- LOGGER .warn ("Connected to another broker than RabbitMQ ('{}'), the library may not behave as expected" , broker );
293+ LOGGER .warn (
294+ "Connected to another broker than RabbitMQ ('{}'), the library may not behave as expected" ,
295+ broker );
293296 }
294297 }
295298
Original file line number Diff line number Diff line change @@ -397,4 +397,27 @@ void connectionClosing() {
397397 c .close ();
398398 }
399399 }
400+
401+ @ Test
402+ void dynamicReceiver () throws Exception {
403+ try (Client client = client ()) {
404+ org .apache .qpid .protonj2 .client .Connection c1 = connection (client );
405+ Session s1 = c1 .openSession ();
406+ ReceiverOptions receiverOptions = new ReceiverOptions ();
407+ receiverOptions .sourceOptions ().capabilities ("temporary-queue" );
408+ Receiver receiver = s1 .openDynamicReceiver (receiverOptions );
409+ receiver .openFuture ().get ();
410+ assertThat (receiver .address ()).isNotNull ();
411+
412+ org .apache .qpid .protonj2 .client .Connection c2 = connection (client );
413+ Session s2 = c2 .openSession ();
414+ Sender sender = s2 .openSender (receiver .address ());
415+ String body = UUID .randomUUID ().toString ();
416+ sender .send (Message .create (body ));
417+
418+ Delivery delivery = receiver .receive (10 , SECONDS );
419+ assertThat (delivery ).isNotNull ();
420+ assertThat (delivery .message ().body ()).isEqualTo (body );
421+ }
422+ }
400423}
You can’t perform that action at this time.
0 commit comments