Kafka出站频道无法接收来自该频道的消息

时间:2018-07-24 08:40:46

标签: spring apache-kafka spring-integration spring-kafka

有一个频道:

<integration:channel id="sampleChannel">
</integration:channel>

还有一个kafka出站通道,其channel属性为sampleChannel值:

  <int-kafka:outbound-channel-adapter id="kafkaOutboundChannelAdapter"
                                        kafka-template="template"
                                        auto-startup="false"
                                        channel="sampleChannel"
                                        topic="foo"
                                        sync="false"
                                        send-failure-channel="errorChannel"
                                        partition-id-expression="1">
    </int-kafka:outbound-channel-adapter>

当消息发送并到达sampleChannel时,抛出此异常:

org.springframework.messaging.MessageDeliveryException: Dispatcher has no subscribers for channel 'org.springframework.context.support.ClassPathXmlApplicationContext@1623b78d.sampleChannel'

为什么卡夫卡出站不能从sampleChannel接收消息?

1 个答案:

答案 0 :(得分:1)

您的auto-startup设置为 false ,因此在启动应用程序上下文时,sampleChannel没有订阅者。 将auto-startup设置为 true 。或将您的sampleChannel更改为可对发布-订阅频道进行轮询。

相关问题