简体   繁体   English

没有发布者可以发布 TcpConnectionOpenEvent / TcpConnectionCloseEvent

[英]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.

相关问题 发布 TcpConnectionOpenEvent 或 TcpConnectionOpenEvent 失败,Dispatcher 传递消息失败 - Failed to publish TcpConnectionOpenEvent Or TcpConnectionOpenEvent, Dispatcher failed to deliver Message Spring 集成:没有发布者可用于发布 TCP 连接相关事件 - Spring Integration : No publisher available to publish TCP Connection related events TcpConnection包装的拦截器发布TcpConnectionOpenEvent,其连接工厂属性未知 - TcpConnection wrapped interceptor publish TcpConnectionOpenEvent whose connection factory property is unknown TcpConnectionCloseEvent之后的Spring Integration消息 - Spring Integration messages after TcpConnectionCloseEvent 发布者应等待经纪人可用 - Publisher should wait till broker is available Spring 集成回复发布者 - Spring Integration reply to Publisher 将远程服务的http响应下沉到发布者 - To sink in the http responses of a remote service to a publisher 当 RabbitMQ 无法路由消息时,发布者确认给出 ACK - Publisher Confirms gives ACK when message can not be routed by RabbitMQ 发布订阅频道可能存在问题 - Possible issue with Publish subscribe Channel Spring 集成 - 发布者确认超时? - Spring integration - Publisher Confirms with timeout?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM