[英]No publisher available to publish TcpConnectionOpenEvent / TcpConnectionCloseEvent
I configured a TCP Client with the Java DSL of Spring Integration.我用 Spring 集成的 Java DSL 配置了 TCP 客户端。 It looks like this
看起来像这样
@Bean
public TcpSendingMessageHandler tcpClient()
{
return Tcp
.outboundAdapter(
Tcp.nioClient("localhost", 9060)
.deserializer(new ByteArrayLfSerializer())
.soKeepAlive(false)
.leaveOpen(false)
.taskExecutor(Executors.newSingleThreadExecutor())
.get()
)
.clientMode(false)
.get();
}
And I am using it in a Service to send messages to the TCP socket the client is connected to:我在服务中使用它向客户端连接到的 TCP 套接字发送消息:
@Slf4j
@Service
public class TcpClientConnectionService
{
private final TcpSendingMessageHandler messageHandler;
@Autowired
public TcpClientConnectionService(final TcpSendingMessageHandler messageHandler)
{
this.messageHandler = messageHandler;
this.messageHandler.start();
}
public void sendMessage(final String message)
{
messageHandler.handleMessage(new GenericMessage<>(message));
log.debug("Message: " + message + " send");
}
}
But in production I am getting the follwing warning rather regulary and I do not know what the issue is and how to fix it.但是在生产中,我经常收到以下警告,我不知道问题是什么以及如何解决它。
osiitcp.connection.TcpNioConnection: No publisher available to publish TcpConnectionOpenEvent osiitcp.connection.TcpNioConnection: No publisher available to publish TcpConnectionCloseEvent
osiitcp.connection.TcpNioConnection:没有发布者可用于发布 TcpConnectionOpenEvent
It would be great if somebody could help me out since I was not able to find anything by googling.如果有人可以帮助我,那就太好了,因为我无法通过谷歌搜索找到任何东西。
The nested factory is not initialized properly because you are incorrectly calling .get()
on the spec, which subverts Spring initialization.嵌套工厂未正确初始化,因为您在规范上错误地调用了
.get()
,这破坏了 Spring 初始化。
I configured a TCP Client with the Java DSL of Spring Integration.我用 Spring 集成的 Java DSL 配置了 TCP 客户端。 It looks like this
看起来像这样
@Bean
public TcpSendingMessageHandler tcpClient()
{
return Tcp
.outboundAdapter(
Tcp.nioClient("localhost", 9060)
.deserializer(new ByteArrayLfSerializer())
.soKeepAlive(false)
.leaveOpen(false)
.taskExecutor(Executors.newSingleThreadExecutor()))
.clientMode(false)
.get();
}
Or move the factory definition to a top level @Bean
.或者将工厂定义移动到顶级
@Bean
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.