Introduce StompReactorNettyTcpClient
Issue: SPR-11153
This commit is contained in:
@@ -250,12 +250,22 @@ public class StompBrokerRelayMessageHandler extends AbstractBrokerMessageHandler
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for unit testing.
|
||||
* Configure a TCP client for managing TCP connections to the STOMP broker. By default
|
||||
* {@link org.springframework.messaging.simp.stomp.StompReactorNettyTcpClient} is used.
|
||||
*/
|
||||
void setTcpClient(TcpOperations<byte[]> tcpClient) {
|
||||
public void setTcpClient(TcpOperations<byte[]> tcpClient) {
|
||||
this.tcpClient = tcpClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the configured TCP client. Never {@code null} unless not configured
|
||||
* invoked and this method is invoked before the handler is started and
|
||||
* hence a default implementation initialized.
|
||||
*/
|
||||
public TcpOperations<byte[]> getTcpClient() {
|
||||
return this.tcpClient;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void startInternal() {
|
||||
@@ -264,7 +274,7 @@ public class StompBrokerRelayMessageHandler extends AbstractBrokerMessageHandler
|
||||
this.brokerChannel.subscribe(this);
|
||||
|
||||
if (this.tcpClient == null) {
|
||||
this.tcpClient = new ReactorNettyTcpClient<byte[]>(this.relayHost, this.relayPort, new StompCodec());
|
||||
this.tcpClient = new StompReactorNettyTcpClient(this.relayHost, this.relayPort);
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2002-2013 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;
|
||||
import reactor.tcp.encoding.Codec;
|
||||
|
||||
/**
|
||||
* 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());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user