confluentinc / examples

Apache Kafka and Confluent Platform examples and demos
Apache License 2.0
1.92k stars 1.12k forks source link

Edge case of order validation process in microservices-orders in at-least-once semantics #1265

Open tall15421542-lab opened 3 weeks ago

tall15421542-lab commented 3 weeks ago

Description In microservices-orders example, we use numbers of validated OrderValidationResult in the topic to validate a order(ref) instead of the real rule matching.

It should be okay in the initial PR, which all producers and Kafka Streams are configured in exactly once semantics. After this PR which add confluent interceptors, the processor now run in at least once semantic.

This should cause problem, for example, if we have

We would send two Order with the same order id to the Orders topic, one with FAILED state and the other with VALIDATED state.

Troubleshooting It's hard to reproduce the duplicate event delivery in local environment. All the above description is all from my inference. I am new to Kafka and Kafka Streams, so please kindly correct me if I am wrong.