Kafka中不自动消费的问题解决方案
查看源码
如果项目中有多个不同的topic需要消费,那么一定要注意@KafkaListener中id的配置,源码中如下
/**
* The unique identifier of the container managing for this endpoint.(管理此端点的容器的唯一标识符 )
* <p>If none is specified an auto-generated one is provided.
* @return the {@code id} for the container managing for this endpoint.
* @see org.springframework.kafka.config.KafkaListenerEndpointRegistry#getListenerContainer(String)
*/
String id() default "";
上边源码中提到了,id是容器的唯一标识符。
我自己遇到的问题