Configure and Use the Event Sourcing Starter

Implement Your Aggregate Entity (OrderManager)

Your order aggregate flow (OrderManager) implementation will be as follows:

The order manager aggregate class will extend the toolkit's persistent entity class and define the flow logic for command and event handlers inside your custom entity using the flow execution DSL exposed to you from the persistent entity. The flow will be as follows:

The code of the order manager class (with enough documentation for the flow DSL) is on GitHub: OrderManager Java Code.

Configure Your Persistent Aggregate Entity via the Toolkit API

As explained before, you just need to implement the interface PersistentEntityProperties, and the toolkit will auto-discover it for your entity cluster sharding and persistence configuration. The code reference for the config in the working sample is the following: The entity configuration.

Call Your Aggregates From Your Service and Connect Them to Your DDD Service's REST API

First, implement your order broker service that will have a reference for PersistentEntityBroker, which is provided by the toolkit to abstract the cluster sharding lookup for your entity. The Order broker is here: Order Broker.

So I just added the needed Maven dependency, plus the needed Apache Ignite grid configuration for Akka Persistence. That is it. Now, when you build and run the application, it will start the Apache Ignite server node as well which will be used to store the events and snapshots in its own journals

Now in Part 4, we will go through some remarks and different architectures using that toolkit for event sourcing and CQRS services.

For your reference, here is the GitHub toolkit with the working sample URL.