Hi @Ashwini_Kumar,
You could indeed go for either option when it comes to event streaming. However, I am assuming you are using Axon for Event Sourcing as well, correct? Kafka, or Axon’s Kafka Extension, just don’t support Event Sourcing in an efficient matter. Henceforth you wouldn’t be using Kafka as an Event Store solution, but simply as a broker. This by Allard explains nicely what you would need from an Event Store, but also why Kafka isn’t a good fit (definitely worth a watch).
However, you can very well use it for event streaming as pointed out. Henceforth Kafka and thus the Kafka Extension provide means to connect to Axon’s Event Processors like the TrackingEventProcessor
(TEP). When it comes to configuring this, I highly recommend to check out our Reference Guide on the matter. More specifically you would need to use a StreamableMessageSource
for a TEP in general, hence requiring you to configure the StreamableKafkaMessageSource
as the event source of your TEP. The linked ref-guide section should show you how. On top of that, you can check out the sample which is part of the extension repository if you like, which also shows how to set this up (albeit in Kotlin).
So concluding, Kafka is fine for event streaming, not so much as an Event Store. If you are looking for a consolidated solution for both, I would recommend giving Axon Server a spin. It is a tailor made solution to be an Event Store (thus supporting both event streaming and sourcing), as well as a dedicated messaging platform. Hence you would no longer be required to configure Kafka to dispatch messages between connected application. The same would apply for commands and queries by the way.
Hope this helps you out further @Ashwini_Kumar!
Cheers,
Steven