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

Summary


In this chapter, we supplemented our event sourced entity model with a separate read model, following the CQRS pattern. We implemented our separate read models by leveraging Akka's Persistence Query feature to listen to event streams from our entities and project those events into Elasticsearch, which serves as our read model data store. Following this approach gives us rich query capabilities against the current state of our entities while still preserving the event sourced nature of those entities for the write model. We also leveraged Persistence Query to finalize the back-and-forth interaction between the inventory and sales modules when allocating an inventory to a new sales order.

The code we created in this chapter to listen to the event stream was a good starting point, but we really didn't leverage some of the cool features from Akka Streams, such as proper back-pressure handling. We'll plunge right into this in the next chapter, when we introduce Akka Streams as a mechanism...