Vaughn Vernon: Reactive Domain-Driven Design
Using Actor Model together with Doman-Driven Design, DDD, you may be able to remove some of the architecture overhead typically found in event-driven or hexagonal architectures, Vaughn Vernon, author of Implementing Domain-Driven Design, explained in a recent talk about Reactive DDD with Scala and Akka, (an Actor Model implementation).
The new term “Reactive” that has been used lately is really not a totally new concept since many of us are familiar with reacting to events and messages but it offers some refreshing changes for me, Vaughn continued before defining some of the basic characteristics of the Actor model:
- Direct Asynchronous Messaging, one actor is sending a message to another actor directly and asynchronously.
- Lock Free Concurrency. Locks are not handled by actors, only by the infrastructure.
- Share Nothing. Actors don’t know about internal state in other actors.
One of Vaughn’s main motivations for using DDD is that he wants to model the core aspects of the business in a very explicit way. But in a typical event-driven architecture where we are explicit in the domain model and the domain events also add some expressiveness to the model, it is still not entirely clear because once the domain event is published it can be hard to find where in the code that event will be reacted on and where it eventually will have an impact in the model.
In contrast Vaughn finds the actor model very explicit. When an actor sends a message to another actor that is very evident right in the code.
A question for Vaughn is how much we can benefit from using the actor model with DDD? Is it just a matter of sending messages between aggregates using the same architecture as before all around? His answer to that is no, he believes we can get rid of a lot of the architecture overhead that you typically will find in an event-driven or hexagonal architecture. Given the right framework he thinks we can strip the architecture down to just controllers and aggregates where controllers can be actors knowing how to dispatch messages to interact with aggregates in the model.
He doesn’t see any real limitations to where actor model and DDD can be used, instead applicable to any place where high scalability, high availability and low latency are needed.
Akka is built for the Java Virtual Machine, JVM, but Vaughn is currently working on an Akka.NET implementation that is an effort to port Akka to C# and F#.
Earlier this year Vaughn talked about the foundation for actor model together with DDD.
The Reactive Manifesto was published in September 2013 and describes the core ideas behind the concept.
Jdon is a reactive DDD Java framework.
Anatole Tresch Mar 03, 2015