spring-bootaxonbroker

difference between SimpleCommandBus and AxonCommandServerBus


When I am using axon framework and reading documentation I see that I can change the queryBus, commandBus and eventBus, and there is three types : EmbeddedEventStore, SimpleCommandBus and AxonCommandServerBus So What is the difference between SimpleCommandBus, AxonCommandServerBus and EmbeddedEventStore??


Solution

  • As another user answered under this question of yours, Axon supports usages of three types of messages:

    1. Commands - The expression of intent to perform some action inside the domain.
    2. Events - A notification that something relevant has happened inside the domain.
    3. Queries - The request for information or state.

    Knowing this, whenever you're looking for the difference between a CommandBus or EventStore implementation, that translates to the different message types.

    Axon provides a CommandBus to dispatch a command message from one end to another. In doing so, it keeps into mind the specific routing requirements of commands. The EventStore in that perspective is in charge of storing event messages, and allowing a solution to retrieve events for Aggregates (event sourcing) and for Query Models (event streaming).

    Now, to actual describe what they are:

    EmbeddedEventStore

    Implementation of the EventStore interface, using a so-called EventStorageEngine to persist the events. The EventStorageEngine has a JPA, JDBC, Mongo, and In-Memory implementation.

    In short, this is the "configure your own event store" solution of Axon's EventStore. If you prefer to use something with less configuration, I'd recommend using Axon Server.

    SimpleCommandBus

    The SimpleCommandBus is a single JVM, single-threaded implementation of the CommandBus interface. Due to this, it doesn't allow any parallelism in command dispatching and/or handling. Nor does it support the distribution of commands to other instances.

    AxonServerCommandBus

    The AxonServerCommandBus is a distributed, multi-threaded implementation of the CommandBus interface, using Axon Server as the communication layer. Due to this, it allows parallelism within an application. It also knows how to send and retrieve commands to and from other application instances. Note that it expects Axon Server to be running and reachable by your Axon Framework application.


    If you're curious about a more detailed differences between these three, I'd recommend to read the Reference Guide's their respective sections:

    1. EmbeddedEventStore page
    2. SimpleCommandBus page
    3. AxonServerCommandBus page