Book Image

Mastering Akka

By : Christian Baxter
Book Image

Mastering Akka

By: Christian Baxter

Overview of this book

For a programmer, writing multi-threaded applications is critical as it is important to break large tasks into smaller ones and run them simultaneously. Akka is a distributed computing toolkit that uses the abstraction of the Actor model, enabling developers to build correct, concurrent, and distributed applications using Java and Scala with ease. The book begins with a quick introduction that simplifies concurrent programming with actors. We then proceed to master all aspects of domain-driven design. We’ll teach you how to scale out with Akka Remoting/Clustering. Finally, we introduce Conductr as a means to deploy to and manage microservices across a cluster.
Table of Contents (17 chapters)
Mastering Akka
Credits
About the Author
Acknowledgments
About the Reviewer
www.PacktPub.com
Preface

A brief history of CQRS


Before delving into how CQRS will fit into our event sourced app, I thought it important to at least briefly touch on the origins of this approach. Doing so should help you see how this approach evolved and the kinds of problems it was trying to solve.

CQRS has its origins in the Command-Query Separation (CQS) principle, which was first conceived by French technologist Bertrand Meyer, who is the creator of the Eiffel programming language. According to Wikipedia, the definition of CQS is:

It states that every method should either be a command that performs an action, or a query that returns data to the caller, but not both. In other words, asking a question should not change the answer. More formally, methods should return a value only if they are referentially transparent and hence possess no side effect.

In short, if you are returning a value as part of a method invocation (a query) then you cannot also mutate state as part of that call. Also, if you are going to...