/** * Connect and notify the given {@link StompSessionHandler} when connected * on the STOMP level. * @param handler the handler for the STOMP session * @return a ListenableFuture for access to the session when ready for use */ public ListenableFuture<StompSession> connect(StompSessionHandler handler) { return connect(null, handler); }
@Test public void publishSubscribe() throws Exception { String destination = "/topic/foo"; ConsumingHandler consumingHandler1 = new ConsumingHandler(destination); ListenableFuture<StompSession> consumerFuture1 = this.client.connect(consumingHandler1); ConsumingHandler consumingHandler2 = new ConsumingHandler(destination); ListenableFuture<StompSession> consumerFuture2 = this.client.connect(consumingHandler2); assertTrue(consumingHandler1.awaitForSubscriptions(5000)); assertTrue(consumingHandler2.awaitForSubscriptions(5000)); ProducingHandler producingHandler = new ProducingHandler(); producingHandler.addToSend(destination, "foo1"); producingHandler.addToSend(destination, "foo2"); ListenableFuture<StompSession> producerFuture = this.client.connect(producingHandler); assertTrue(consumingHandler1.awaitForMessageCount(2, 5000)); assertThat(consumingHandler1.getReceived(), containsInAnyOrder("foo1", "foo2")); assertTrue(consumingHandler2.awaitForMessageCount(2, 5000)); assertThat(consumingHandler2.getReceived(), containsInAnyOrder("foo1", "foo2")); consumerFuture1.get().disconnect(); consumerFuture2.get().disconnect(); producerFuture.get().disconnect(); }
/** * Connect and notify the given {@link StompSessionHandler} when connected * on the STOMP level. * @param handler the handler for the STOMP session * @return a ListenableFuture for access to the session when ready for use */ public ListenableFuture<StompSession> connect(StompSessionHandler handler) { return connect(null, handler); }
@Override protected ListenableFuture<StompSession> doConnect(StompSessionHandler handler) { return ((ReactorNettyTcpStompClient) this.stompClient).connect(getConnectHeaders(), handler); }
/** * Connect and notify the given {@link StompSessionHandler} when connected * on the STOMP level. * @param handler the handler for the STOMP session * @return a ListenableFuture for access to the session when ready for use */ public ListenableFuture<StompSession> connect(StompSessionHandler handler) { return connect(null, handler); }
/** * Connect and notify the given {@link StompSessionHandler} when connected * on the STOMP level. * @param handler the handler for the STOMP session * @return a ListenableFuture for access to the session when ready for use */ public ListenableFuture<StompSession> connect(StompSessionHandler handler) { return connect(null, handler); }