Kafka 配置消费着 20:28:14 org.springframework.context.ApplicationContextException: Failed to start bean 'org.springframework.kafka.config.internalKafkaListenerEndpointRegistry'; nested exception is java.lang.IllegalStateException: No group.id found in consumer config, container properties, or @KafkaListener annotation; a group.id is required when group management is used.
解决办法:
1:配置文件
kafka:
kafkaServers: 10.23.45.56:9092
consumer_check:
processName: daa_check
autoCommit: false
timeout: 300000
interval: 500000
reset: latest
topic: task_daa_data_topic
groupId: task_imp_std_group_id
threads: 1
2.消费者监听
@KafkaListener(topics = {"${kafka.consumer_check.topic}"}, groupId = "${kafka.consumer_check.groupId}")
public void listener(ConsumerRecord<?, ?> record) throws IOException, NoSuchMethodException, org.locationtech.jts.io.ParseException, I

本文介绍了如何正确配置Kafka消费者以避免group.id未定义的问题。通过配置文件设置group.id,并在消费者监听中引用该配置,确保了消费者能够正常运行。
最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



