1

I am developing an app (microservices-based) relying on Kafka and Kafka Streams. I am using Spring Boot and Spring Cloud Stream for that and I am having trouble with handling transactions for Kafka Streams operations. I know that there is no problem with handling transactions purely with Kafka consumer however when I try to add Kafka Streams processing in the middle it becomes tricky to me.

The example case is:

  1. In one of my services order request for a product is consumed from topic A.
  2. Inventory info is consumed from topic B
  3. This service produces inventory updates to topic B but it is also responsible for publishing events regarding products being ready for shipping (to topic C)
  4. When receiving order request from topic A I want to check (by processing topic B) whether inventory for particular product is sufficient and publish an event with either success or failure (regarding that order) to topic C.
  5. At the same time I need to update inventory (subtract the quantity that is let's say reserved for shipping) so that for next order I have actual values from topic B. I want to post success to topic C and update inventory on topic B within one transaction.

Is that possible in spring cloud stream with kafka streams? And if yes, how can I manage to do that?

redfox
  • 178
  • 1
  • 9
  • Spring Cloud Stream relies on the transactional capabilities provided by Apache Kafka. You might want to look up on how to do that in Kafka. This post has a handful of links you can follow: https://stackoverflow.com/a/48268771 – sobychacko Apr 16 '19 at 16:22

0 Answers0