Spring integration Spring集成-Dispatcher没有通道的订阅服务器

Spring integration Spring集成-Dispatcher没有通道的订阅服务器,spring-integration,Spring Integration,Spring Integration 5.3.2的一个非常简单的示例:使用Spring Integration DSL和IntegrationFlowContext注册的单个集成流: ` 收益率org.springframework.messaging.MessageDeliveryException:Dispatcher没有频道的订户 为什么??添加单个.transform(e->e)(例如)可以解决问题,但显然是一种奇怪的解决方法。这绝对是一种预期行为。您声明了一个MessageChanne

Spring Integration 5.3.2的一个非常简单的示例:使用Spring Integration DSL和IntegrationFlowContext注册的单个集成流:

`

收益率
org.springframework.messaging.MessageDeliveryException:Dispatcher没有频道的订户


为什么??添加单个
.transform(e->e)
(例如)可以解决问题,但显然是一种奇怪的解决方法。

这绝对是一种预期行为。您声明了一个
MessageChannel
并向其中发送了一条消息,但没有为该频道声明订户。因此,当您添加
transform()
时,您确实看到了差异。你应该自己决定你的逻辑是什么,当这个频道有信息时你想做什么。你可以考虑使用其他的通道类型,但是仍然要考虑如何处理消息。我并不总是清楚什么算订阅者,什么算不算订阅者。请参阅
log()
JavaDocs:它是一个通道拦截器,而不是一个带有订阅者库的端点。我担心我还有更多的问题,但我会从不同的线程开始。
    MessageChannel startChannel = MessageChannels.direct("channel").get();

    StandardIntegrationFlow flow = IntegrationFlows.from(startChannel)
            .log().get();

    flowContext.registration(flow)
            .autoStartup(false)
            .register();

    flow.start();

    startChannel.send(MessageBuilder.withPayload("test").build());`