org.springframework.messaging.tcp.TcpConnectionHandler Java Examples
The following examples show how to use
org.springframework.messaging.tcp.TcpConnectionHandler.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ReactorNettyTcpClient.java From spring-analysis-note with MIT License | 6 votes |
@Override public ListenableFuture<Void> connect(TcpConnectionHandler<P> handler, ReconnectStrategy strategy) { Assert.notNull(handler, "TcpConnectionHandler is required"); Assert.notNull(strategy, "ReconnectStrategy is required"); if (this.stopping) { return handleShuttingDownConnectFailure(handler); } // Report first connect to the ListenableFuture MonoProcessor<Void> connectMono = MonoProcessor.create(); this.tcpClient .handle(new ReactorNettyHandler(handler)) .connect() .doOnNext(updateConnectMono(connectMono)) .doOnError(updateConnectMono(connectMono)) .doOnError(handler::afterConnectFailure) // report all connect failures to the handler .flatMap(Connection::onDispose) // post-connect issues .retryWhen(reconnectFunction(strategy)) .repeatWhen(reconnectFunction(strategy)) .subscribe(); return new MonoToListenableFutureAdapter<>(connectMono); }
Example #2
Source File: ReactorNettyTcpClient.java From spring-analysis-note with MIT License | 6 votes |
@Override public ListenableFuture<Void> connect(final TcpConnectionHandler<P> handler) { Assert.notNull(handler, "TcpConnectionHandler is required"); if (this.stopping) { return handleShuttingDownConnectFailure(handler); } Mono<Void> connectMono = this.tcpClient .handle(new ReactorNettyHandler(handler)) .connect() .doOnError(handler::afterConnectFailure) .then(); return new MonoToListenableFutureAdapter<>(connectMono); }
Example #3
Source File: Reactor2TcpClient.java From spring4-understanding with Apache License 2.0 | 6 votes |
@Override public ListenableFuture<Void> connect(TcpConnectionHandler<P> connectionHandler, ReconnectStrategy strategy) { Assert.notNull(connectionHandler, "TcpConnectionHandler must not be null"); Assert.notNull(strategy, "ReconnectStrategy must not be null"); TcpClient<Message<P>, Message<P>> tcpClient; synchronized (this.tcpClients) { if (this.stopping) { IllegalStateException ex = new IllegalStateException("Shutting down."); connectionHandler.afterConnectFailure(ex); return new PassThroughPromiseToListenableFutureAdapter<Void>(Promises.<Void>error(ex)); } tcpClient = NetStreams.tcpClient(REACTOR_TCP_CLIENT_TYPE, this.tcpClientSpecFactory); this.tcpClients.add(tcpClient); } Stream<Tuple2<InetSocketAddress, Integer>> stream = tcpClient.start( new MessageChannelStreamHandler<P>(connectionHandler), new ReactorReconnectAdapter(strategy)); return new PassThroughPromiseToListenableFutureAdapter<Void>(stream.next().after()); }
Example #4
Source File: ReactorNettyTcpClient.java From java-technology-stack with MIT License | 6 votes |
@Override public ListenableFuture<Void> connect(final TcpConnectionHandler<P> handler) { Assert.notNull(handler, "TcpConnectionHandler is required"); if (this.stopping) { return handleShuttingDownConnectFailure(handler); } Mono<Void> connectMono = this.tcpClient .handle(new ReactorNettyHandler(handler)) .connect() .doOnError(handler::afterConnectFailure) .then(); return new MonoToListenableFutureAdapter<>(connectMono); }
Example #5
Source File: ReactorNettyTcpClient.java From java-technology-stack with MIT License | 6 votes |
@Override public ListenableFuture<Void> connect(TcpConnectionHandler<P> handler, ReconnectStrategy strategy) { Assert.notNull(handler, "TcpConnectionHandler is required"); Assert.notNull(strategy, "ReconnectStrategy is required"); if (this.stopping) { return handleShuttingDownConnectFailure(handler); } // Report first connect to the ListenableFuture MonoProcessor<Void> connectMono = MonoProcessor.create(); this.tcpClient .handle(new ReactorNettyHandler(handler)) .connect() .doOnNext(updateConnectMono(connectMono)) .doOnError(updateConnectMono(connectMono)) .doOnError(handler::afterConnectFailure) // report all connect failures to the handler .flatMap(Connection::onDispose) // post-connect issues .retryWhen(reconnectFunction(strategy)) .repeatWhen(reconnectFunction(strategy)) .subscribe(); return new MonoToListenableFutureAdapter<>(connectMono); }
Example #6
Source File: WebSocketStompClient.java From spring4-understanding with Apache License 2.0 | 4 votes |
public WebSocketTcpConnectionHandlerAdapter(TcpConnectionHandler<byte[]> connectionHandler) { Assert.notNull(connectionHandler); this.connectionHandler = connectionHandler; }
Example #7
Source File: StompBrokerRelayMessageHandlerTests.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Override public ListenableFuture<Void> connect(TcpConnectionHandler<byte[]> handler, ReconnectStrategy strategy) { this.connectionHandler = handler; handler.afterConnected(this.connection); return getVoidFuture(); }
Example #8
Source File: StompBrokerRelayMessageHandlerTests.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Override public ListenableFuture<Void> connect(TcpConnectionHandler<byte[]> handler) { this.connectionHandler = handler; handler.afterConnected(this.connection); return getVoidFuture(); }
Example #9
Source File: Reactor2TcpClient.java From spring4-understanding with Apache License 2.0 | 4 votes |
public MessageChannelStreamHandler(TcpConnectionHandler<P> connectionHandler) { this.connectionHandler = connectionHandler; }
Example #10
Source File: WebSocketStompClient.java From java-technology-stack with MIT License | 4 votes |
public WebSocketTcpConnectionHandlerAdapter(TcpConnectionHandler<byte[]> connectionHandler) { Assert.notNull(connectionHandler, "TcpConnectionHandler must not be null"); this.connectionHandler = connectionHandler; }
Example #11
Source File: StompBrokerRelayMessageHandlerTests.java From java-technology-stack with MIT License | 4 votes |
@Override public ListenableFuture<Void> connect(TcpConnectionHandler<byte[]> handler, ReconnectStrategy strategy) { this.connectionHandler = handler; handler.afterConnected(this.connection); return getVoidFuture(); }
Example #12
Source File: StompBrokerRelayMessageHandlerTests.java From java-technology-stack with MIT License | 4 votes |
@Override public ListenableFuture<Void> connect(TcpConnectionHandler<byte[]> handler) { this.connectionHandler = handler; handler.afterConnected(this.connection); return getVoidFuture(); }
Example #13
Source File: ReactorNettyTcpClient.java From java-technology-stack with MIT License | 4 votes |
ReactorNettyHandler(TcpConnectionHandler<P> handler) { this.connectionHandler = handler; }
Example #14
Source File: ReactorNettyTcpClient.java From java-technology-stack with MIT License | 4 votes |
private ListenableFuture<Void> handleShuttingDownConnectFailure(TcpConnectionHandler<P> handler) { IllegalStateException ex = new IllegalStateException("Shutting down."); handler.afterConnectFailure(ex); return new MonoToListenableFutureAdapter<>(Mono.error(ex)); }
Example #15
Source File: WebSocketStompClient.java From spring-analysis-note with MIT License | 4 votes |
public WebSocketTcpConnectionHandlerAdapter(TcpConnectionHandler<byte[]> connectionHandler) { Assert.notNull(connectionHandler, "TcpConnectionHandler must not be null"); this.connectionHandler = connectionHandler; }
Example #16
Source File: StompBrokerRelayMessageHandlerTests.java From spring-analysis-note with MIT License | 4 votes |
@Override public ListenableFuture<Void> connect(TcpConnectionHandler<byte[]> handler, ReconnectStrategy strategy) { this.connectionHandler = handler; handler.afterConnected(this.connection); return getVoidFuture(); }
Example #17
Source File: StompBrokerRelayMessageHandlerTests.java From spring-analysis-note with MIT License | 4 votes |
@Override public ListenableFuture<Void> connect(TcpConnectionHandler<byte[]> handler) { this.connectionHandler = handler; handler.afterConnected(this.connection); return getVoidFuture(); }
Example #18
Source File: ReactorNettyTcpClient.java From spring-analysis-note with MIT License | 4 votes |
ReactorNettyHandler(TcpConnectionHandler<P> handler) { this.connectionHandler = handler; }
Example #19
Source File: ReactorNettyTcpClient.java From spring-analysis-note with MIT License | 4 votes |
private ListenableFuture<Void> handleShuttingDownConnectFailure(TcpConnectionHandler<P> handler) { IllegalStateException ex = new IllegalStateException("Shutting down."); handler.afterConnectFailure(ex); return new MonoToListenableFutureAdapter<>(Mono.error(ex)); }