Kafka: How to automatically reverse messages to the event bus


I’m trying to orchestrate a saga among micorservices composing my architecture using Axon Framework.

I read the documentation and java examples in order to try to receive events from a kafka topic using the fetcher class provided by Axon Kafka module extension:


It seems that events have to stay on the event bus in order to trigger next state of my saga. It looks like that using the Fetcher class, the events are not automatically published to event bus, but i need to programmatically publish events to the bus just after fetching them from Kafka.
Is this the correct way to operate or there is an automagically configuration that i have missed?


Hi Andrea,

I am not 100% sure I follow your question, but let me try to answer it any how.

The axon-kafka module provides a Message Source for your Event Processor.
The Event Bus / Event Store is an entirely different Message Source then Kafka (or AMQP for example).

A Saga instance does no particularly care if the events it handles are from a Message Source backed by Kafka or the EventBus, as long as it receives the events.
You are thus not required to publish events you receive from a Kafka topic on the EventBus for your Sagas.
I am not sure from where you’ve retrieved this idea, but that might be important to answer your question correctly.

You have also not missed any configuration.
It is not ‘automagically’ possible to fetch events from a Kafka topic and put them on the EventBus of your axon application.
If you would want something like this, I’d suggest you have a Event Processor fetching from the Kafka topic which in turn appends those events to the EventStore.
If you are however pursuing this path to be able to update your query models based on the events from a Kafka topic, you can simply switch the message source of those Event Handlers over to the Kafka topic in question.

As pointed out at the start, I am not completely sure this answers the question you have Andrea.
Thus do not hesitate to send a follow up question after this.