spring-integration icon indicating copy to clipboard operation
spring-integration copied to clipboard

[Feature Request] Reactor Kafka channel adapter

Open rolkhas2 opened this issue 3 years ago • 4 comments

Expected Behavior I'd expect there to be full Apache Kafka support since this is one of the most popular technologies, but for some reason, I didn't see any reactive Kafka channel adapter. That prevents me from using the adapter. I also didn't manage to understand if there's an async Kafka channel adapter, so if there is I think that can get documented better.

Current Behavior Only Spring-Kafka support. No relation with Reactor-Kafka.

Context I'm trying to build a simple data pipeline in the Reactive Spring Integration way.

rolkhas2 avatar Jul 16 '22 16:07 rolkhas2

It is possible at the moment with a combination of Reactor Kafka and MessageProducerSupport.subscribeToPublisher(Publisher<? extends Message<?>> publisher): https://docs.spring.io/spring-integration/docs/current/reference/html/reactive-streams.html#event-driven-channel-adapter. Or there is a nice trick via ReactiveMessageSourceProducer and existing KafkaMessageSource. See the same doc.

We definitely will look into reactive channel adapters for Apache Kafka somewhere in the future.

artembilan avatar Jul 16 '22 16:07 artembilan

BTW, the logic for Reactor Kafka channel adapters really might be borrowed from a new Reactor Kafka binder in Spring Cloud Stream: https://github.com/spring-cloud/spring-cloud-stream/blob/main/binders/kafka-binder/spring-cloud-stream-binder-kafka-reactive/src/main/java/org/springframework/cloud/stream/binder/reactorkafka/ReactorKafkaBinder.java

artembilan avatar Jul 16 '22 17:07 artembilan

@artembilan yes you're right. That's pretty simple to create such binders (shouldn't take more than a couple of hours). I'll try to implement that later.

rolkhas2 avatar Jul 16 '22 17:07 rolkhas2

Super improtant though

rolkhas2 avatar Jul 16 '22 17:07 rolkhas2