akka-ddd Build Status Version

Join the chat at https://gitter.im/pawelkaczor/akka-ddd

Reusable artifacts for building applications on top of the Akka platform following CQRS/DDDD-based approach.

Used by: DDD Leaven Akka Ver 2

Modules overview

akka-ddd-core

Contains core artifacts to be used on the write side of the system:

  • AggregateRoot trait - abstract persistent, event sourced actor responsible for processing commands received from the office. Implementation of AggregateRoot trait represents concrete business entity (i.e Reservation, Product, etc)

For more information visit the documentation.

  • Office - an actor that is used by the client to talk to Aggregate Roots of a particular class. See Don't call me, call my office for explanation. There are two office implementations: "simple" (used for testing) and "global" / distributed (implemented using Akka Sharding)

  • Receptor - allows one office to react on events occurred in another office. Receptor is capable of filtering input events received from configured event stream, transforming them into arbitrary output messages and routing output messages to configured fixed or dynamic (derived from the message) destination. To make configuration of these capabilities straightforward ReceptorBuilder provides simple DSL. Here you can find an example configuration of typical receptor that receives event from one office and sends command to another office. Actual logic of reading events from event stream is pluggable - EventStreamSubscriber must be mixed into Receptor class. Ready to use EventstoreSubscriber is provided by eventstore-akka-persistence module.

  • Saga / Process Manager - implementation of Saga / Process Manager pattern. See: Saga - big picture. See example Process Manager: OrderProcessManager

eventstore-akka-persistence

Incorporates Akka Persistence journal and snapshot-store backed by Event Store. Registers JSON Serializer as Akka custom serializer for akka.persistence.PersistentRepr (wrapper class that is used by Akka Persistence to store event in the journal). Provides also EventstoreSubscriber that should be mixed into the Receptor (available in akka-ddd-core).

akka-ddd-scheduling

Provides durable scheduler (backed by the Event Store!) that is typically used by a Saga to schedule timeout/deadline messages. See: Durable Scheduler - big picture.

view-update

Generic artifacts for building View Update Service - a service that consumes events from an Event Store and updates a View Store (i.e. SQL database). See: View Update Service - big picture

view-update-sql

SQL-specific implementation of view-update artifacts.

akka-ddd-test

Allows easy creation of Aggregate Root specifications (tests). See Testing Aggregate Root’s behavior.

akka-ddd-write-front

Provides building blocks for the write-front application.

  • HttpCommandHandler - a route (building block of the Akka Http endpoint) responsible for unmarshalling commands received in json format as HTTP POST requests. Once the command is unmarshalled, the handler passes it further to the CommandDispatcher. Eventually, once the command is processed on the backend and the response is received from the office (asynchronously), the handler converts it to an appropriate HTTP response that needs to be returned to the client.

  • CommandDispatcher - takes care of forwarding the incoming commands to the appropriate offices operating on backend. The forwarding is performed using the Akka Cluster Client.