Rename ReactorNettyTcpClient to ReactorTcpClient

Even though Netty is a required dependency of reactor-tcp at present,
there is no hard dependency in the spring-messaging Reactor-based
implementation.
master
Rossen Stoyanchev 11 years ago
parent 2e13bf8b81
commit f68bd5c8b2
  1. 6
      spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompBrokerRelayMessageHandler.java
  2. 34
      spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompReactorNettyTcpClient.java
  3. 8
      spring-messaging/src/main/java/org/springframework/messaging/tcp/reactor/ReactorTcpClient.java

@ -32,7 +32,7 @@ import org.springframework.messaging.tcp.FixedIntervalReconnectStrategy;
import org.springframework.messaging.tcp.TcpConnection; import org.springframework.messaging.tcp.TcpConnection;
import org.springframework.messaging.tcp.TcpConnectionHandler; import org.springframework.messaging.tcp.TcpConnectionHandler;
import org.springframework.messaging.tcp.TcpOperations; import org.springframework.messaging.tcp.TcpOperations;
import org.springframework.messaging.tcp.reactor.ReactorNettyTcpClient; import org.springframework.messaging.tcp.reactor.ReactorTcpClient;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.util.concurrent.ListenableFuture; import org.springframework.util.concurrent.ListenableFuture;
import org.springframework.util.concurrent.ListenableFutureCallback; import org.springframework.util.concurrent.ListenableFutureCallback;
@ -302,7 +302,7 @@ public class StompBrokerRelayMessageHandler extends AbstractBrokerMessageHandler
/** /**
* Configure a TCP client for managing TCP connections to the STOMP broker. * Configure a TCP client for managing TCP connections to the STOMP broker.
* By default {@link org.springframework.messaging.tcp.reactor.ReactorNettyTcpClient} is used. * By default {@link org.springframework.messaging.tcp.reactor.ReactorTcpClient} is used.
*/ */
public void setTcpClient(TcpOperations<byte[]> tcpClient) { public void setTcpClient(TcpOperations<byte[]> tcpClient) {
this.tcpClient = tcpClient; this.tcpClient = tcpClient;
@ -750,7 +750,7 @@ public class StompBrokerRelayMessageHandler extends AbstractBrokerMessageHandler
private static class StompTcpClientFactory { private static class StompTcpClientFactory {
public TcpOperations<byte[]> create(String relayHost, int relayPort) { public TcpOperations<byte[]> create(String relayHost, int relayPort) {
return new ReactorNettyTcpClient<byte[]>(relayHost, relayPort, new StompCodec()); return new ReactorTcpClient<byte[]>(relayHost, relayPort, new StompCodec());
} }
} }

@ -1,34 +0,0 @@
/*
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.messaging.simp.stomp;
import org.springframework.messaging.tcp.reactor.ReactorNettyTcpClient;
/**
* A variation of {@link ReactorNettyTcpClient} for sending and receiving STOMP frames.
*
* @author Rossen Stoyanchev
* @since 4.0.1
*/
public class StompReactorNettyTcpClient extends ReactorNettyTcpClient<byte[]> {
public StompReactorNettyTcpClient(String host, int port) {
super(host, port, new StompCodec());
}
}

@ -53,12 +53,12 @@ import reactor.tuple.Tuple2;
* @author Rossen Stoyanchev * @author Rossen Stoyanchev
* @since 4.0 * @since 4.0
*/ */
public class ReactorNettyTcpClient<P> implements TcpOperations<P> { public class ReactorTcpClient<P> implements TcpOperations<P> {
public static final Class<NettyTcpClient> REACTOR_TCP_CLIENT_TYPE = NettyTcpClient.class; public static final Class<NettyTcpClient> REACTOR_TCP_CLIENT_TYPE = NettyTcpClient.class;
private final static Log logger = LogFactory.getLog(ReactorNettyTcpClient.class); private final static Log logger = LogFactory.getLog(ReactorTcpClient.class);
private TcpClient<Message<P>, Message<P>> tcpClient; private TcpClient<Message<P>, Message<P>> tcpClient;
@ -75,7 +75,7 @@ public class ReactorNettyTcpClient<P> implements TcpOperations<P> {
* @param port the port to connect to * @param port the port to connect to
* @param codec the codec to use for encoding and decoding the TCP stream * @param codec the codec to use for encoding and decoding the TCP stream
*/ */
public ReactorNettyTcpClient(String host, int port, Codec<Buffer, Message<P>, Message<P>> codec) { public ReactorTcpClient(String host, int port, Codec<Buffer, Message<P>, Message<P>> codec) {
this.tcpClient = new TcpClientSpec<Message<P>, Message<P>>(REACTOR_TCP_CLIENT_TYPE) this.tcpClient = new TcpClientSpec<Message<P>, Message<P>>(REACTOR_TCP_CLIENT_TYPE)
.env(new Environment()) .env(new Environment())
.codec(codec) .codec(codec)
@ -93,7 +93,7 @@ public class ReactorNettyTcpClient<P> implements TcpOperations<P> {
* *
* @param tcpClient the TcpClient to use * @param tcpClient the TcpClient to use
*/ */
public ReactorNettyTcpClient(TcpClient<Message<P>, Message<P>> tcpClient) { public ReactorTcpClient(TcpClient<Message<P>, Message<P>> tcpClient) {
Assert.notNull(tcpClient, "'tcpClient' must not be null"); Assert.notNull(tcpClient, "'tcpClient' must not be null");
this.tcpClient = tcpClient; this.tcpClient = tcpClient;
} }
Loading…
Cancel
Save