Skip to content

LukasGasior1/free-event-sourcing-with-akka

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

This proof of concept project is meant to show a way to decouple domain logic from actor but still be able to use facilities that come with it (sending messages to other actors, persistence, etc.).

It uses free monads to implement domain logic in a pure way which is then interpreted in a context of actor.

The domain is an event-sourced aggregate root: Game. It handles GameCommands with handleCommand which in the end gives a list of GameEvents and a CommandResult (either CommandSuccess or CommandError). Game state can only be changed by applying events using handleEvent.

This example project addresses following CQRS/ES use case:

  1. Player wants to join a game (sends a command)
  2. Game needs to contact external service (asynchronously) to check whether player is allowed to join
  3. Game generates suitable event(s) or reply to the sender with an error

Notice that no logic associated with external service communication is implemented in Game class. It just knows a set of operations it can use and not worry about how and where are they implemented.

About

Event sourcing + Akka + Free monads

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages