0

I want to use Spring Cloud Stream for consuming and processing Apache Kafka queues and writing them to MongoDB. I saw that there is an option of using the library so that functions will be Reactive, or Imperative. In most Spring projects the imperative way is the default, but as for my understanding, in spring cloud stream the reactive paradigm is the default.

I wonder what is considered the most “stable” api e.g. what is recommended to use for enterprise?

user7551211
  • 649
  • 1
  • 6
  • 25

1 Answers1

1

Reactive API is stable and yes we provide support for it. In other words you can write functions using reactive API (e.g., Function<Flux, Flux>). However, i want to be very clear that support for API does not mean support for the full stack of reactive capabilities since those actually depend on source and targets which are not reactive.

That said, with Kafka you can rely on native reactive support provided by Kafka itself and Spring Cloud Stream using Kafka Streams binder - https://docs.spring.io/spring-cloud-stream-binder-kafka/docs/3.1.5/reference/html/spring-cloud-stream-binder-kafka.html#_kafka_streams_binder

Oleg Zhurakousky
  • 5,820
  • 16
  • 17
  • So you're saying that I can use the imperative paradigm with Kafka Streams and still be nio? Also, does the Reactive API fully supported in all of Spring Projects? I'm pretty confused about what is the most recommended API in general for a Spring ecosystem user who searches for stability and LTS. – user7551211 Nov 16 '21 at 09:56