我使用的是spring-kafka 2.5.4和spring boot 2.3.2。我有一些带有@StreamListener注解的方法。我想为所有的方法添加一个通用的拦截器。我已经尝试了@EnableKafka和ConcurrentKafkaListenerContainerFactory bean,但它不起作用。
我也不想自己配置ConsumerFactory,而是让spring-kafka来处理。我只想在现有配置的基础上构建,并在其上添加我的RecordInterceptor。
发布于 2021-02-22 23:21:50
spring-cloud-stream不使用该容器工厂,它创建自己的容器。
使用spring-cloud-stream,您需要添加一个ListenerContainerCustomizer bean来修改容器。
https://stackoverflow.com/questions/66317375
复制相似问题