【发布时间】:2020-02-28 12:23:17
【问题描述】:
我有一个基于这个问题的问题:Filter messages before deserialization based on headers
我想使用 Spring Integration DSL 按 kafka 消费者记录标头进行过滤。
目前我有这个流程:
@Bean
IntegrationFlow readTicketsFlow(KafkaProperties kafkaProperties,
ObjectMapper jacksonObjectMapper,
EventService<Ticket> service) {
Map<String, Object> consumerProperties = kafkaProperties.buildConsumerProperties();
DefaultKafkaConsumerFactory<String, String> consumerFactory = new DefaultKafkaConsumerFactory<>(consumerProperties);
return IntegrationFlows.from(
Kafka.messageDrivenChannelAdapter(
consumerFactory, TICKET_TOPIC))
.transform(fromJson(Ticket.class, new Jackson2JsonObjectMapper(jacksonObjectMapper)))
.handle(service)
.get();
}
如何在此流程中注册org.springframework.kafka.listener.adapter.RecordFilterStrategy?
【问题讨论】:
标签: apache-kafka spring-integration spring-kafka