Can Saga replace Axon server

If I use Saga in my project and saga sends command and receive event does it means that I can discard Axon server as message dispatcher and its only roll as event store?
If so what do I need to configure it? and If I do want Axon server to act as my message dispatcher while using saga what do I need to do?

Hey @ei_ei!

Axon Framework’s support for the Saga pattern and Axon Server are actually two entirely different things.

The Saga is a component that handles messages and potentially dispatches messages. The messages it handles are always events, while the messages it dispatches are in most cases commands or operations to other third-party services.

Axon Server on the other hand is not a message handler at all.
It is, in short, a command bus, event bus, query bus, and event store.

A Saga, intended to describe ‘a complex business process’ in your domain, is neither of those four points.

Now with that cleared out, let’s move to your questions.

If I use Saga in my project and saga sends command and receive event does it means that I can discard Axon server as message dispatcher and its only roll as event store?

If you’d want to go without Axon Server, but still require distribution of commands, you will have to configure another type of Distributed CommandBus. Axon’s Reference Guide has this to say about it.

In short, you have the freedom to use roughly three implementations:

  1. Axon Server
  2. JGroups
  3. Spring Cloud Discovery

If you’d like, you could use JGroups / Spring Cloud Discovery as the distribution means for commands, while Axon Server is the event store. Note that this will introduce more configuration requirements for you and your team opposed to letting Axon Server take all the steps.

and If I do want Axon server to act as my message dispatcher while using saga what do I need to do?

If you have a default configuration of Axon Framework, simply running an Axon Server instance is sufficient. Axon Framework applications know the default host and port combination of Axon Server and are biased to connect with it. In such a setup, you’d automatically use the distributed command, event, and query bus, as well as its event store.

I hope this clarifies things for you a bit more @ei_ei!

Thank you very much. I had in mind that saga is the command/event bus instead of Axon server for some reason