My Order
aggregate root is able to emit several Event
, e.g. OrderCreated
, OrderPaid
, OrderCancelled
. Would it be good design to store all types of order event into single kafka topic and to have the orderId
as the message key, as suggested here? Or Should I create sepparate topic for each of them?
The pro of having single topic is that the order of events is maintained, but consumer would need to filter some events on their end. The pro of second approach is consumer would be simpler as they can subscribe to the exact topic that they need, but constructing Order
requires subscribing to multiple topic while they don't come from kafka in the right sequence as they are from different topics.
Thank you
I am not sure if there is a right/wrong question, however here are my two pennies' worth of it:
Hope that helps and good look with your project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With