【发布时间】:2021-10-13 07:59:08
【问题描述】:
由于不推荐使用 @EnableBinding 和 @StreamListener(Sink.INPUT) 以支持函数,因此我需要创建一个可以从 Kafka 主题读取消息的使用者。 我的消费者函数:
@Bean
public Consumer<Person> log() {
return person -> {
System.out.println("Received: " + person);
};
}
,application.yml 配置
spring:
cloud:
stream:
kafka:
binder:
brokers: localhost:9092
bindings:
consumer:
destination: messages
contentType: application/json
它没有连接到主题 messages,而是一直连接到 log-in-0 主题。 我该如何解决这个问题?
【问题讨论】:
标签: apache-kafka spring-cloud spring-cloud-stream