Book description
Master the art of creating scalable, concurrent, and reactive applications using Akka
About This Book
This book will help you cure anemic models with domain-driven design
We cover major Akka programming concepts such as concurrency, scalability, and reactivity
You will learn concepts like Event Sourcing and CQRS via Akka Persistence, Akka Streams, Akka Http as well as Akka Clustering
Who This Book Is For
If you want to use the Lightbend platform to create highly performant reactive applications, then this book is for you. If you are a Scala developer looking for techniques to use all features of the new Akka release and want to incorporate these solutions in your current or new projects, then this book is for you. Expert Java developers who want to build scalable, concurrent, and reactive application will find this book helpful.
What You Will Learn
Use Akka actors to enable parallel execution
Build out domain-driven design based components like entities and aggregates
Respond to command requests on that aggregate root that affect the internal state
Leverage Akka Persistence, protobuf and Cassandra to save the persistent state of you entities
Build out complex processing graphs with the Graph Builder DSL
Understand the dynamic push/pull nature of backpressure handling within Akka Streams
Route HTTP requests to an actor and return a response
Deploy actor instances across a set of nodes via ConductR for high availability
In Detail
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.
Style and approach
This comprehensive, fast-paced guide is packed with several real-world use cases that will help you understand concepts, issues, and resolutions while using Akka to create highly performant, scalable, and concurrency-proof reactive applications.
Table of contents
-
Mastering Akka
- Mastering Akka
- Credits
- About the Author
- Acknowledgments
- About the Reviewer
- www.PacktPub.com
- Preface
-
1. Building a Better Reactive App
- Understanding the initial example app
- Working with the example application
- So what's wrong with this application?
- Summary
-
2. Simplifying Concurrent Programming with Actors
- Understanding the actor model's origin
- Differentiating concurrency and parallelism
- Using Akka actors for safe concurrency
- A word on dispatchers in Akka
- Mailbox types in Akka
-
Refactoring a bad actor to FSM
- Modeling the new process flow
-
Coding the new order process flow
- Defining state and data representations
- Implementing the idle state handling
- Implementing the ResolvingDependencies state handling
- Implementing the LookingUpEntities state handling
- Implementing the ChargingCard state handling
- Implementing the WritingEntity state handling
- Handling unhandled events
- Summing up the refactor
- Testing your Akka actors
- Summary
-
3. Curing Anemic Models with Domain-Driven Design
- What is DDD?
- Identifying anemic vs rich models
- Designing our DDD refactor
- Understanding the refactored bookstore code
- Fixing the transaction in the order creation process
- Improvements needed for the refactor
- Refactoring homework
- Summary
-
4. Making History with Event Sourcing
- Event sourcing primer
- Akka Persistence for event sourcing
- Using Cassandra for our persistent store
- Refactoring the inventory management module
- The refactored sales order processing module
- Refactoring homework
- Summary
-
5. Separating Concerns with CQRS
- A brief history of CQRS
- CQRS in the event sourced world
- Designing our read model implementation
- Implementing the Book read model
- Refactoring sales order processing
- Playing around with the new application
- Refactoring homework
- Closing comments
- Summary
-
6. Going with the Flow with Akka Streams
- Understanding the Reactive Streams API
- The Akka Streams API
- Refactoring the view building code
- Refactoring homework
- Summary
-
7. REST Easy with Akka HTTP
- Creating RESTful HTTP interfaces
- Comparing Akka HTTP to Spray
-
Creating RESTful interfaces with Akka HTTP
- Using the low-level server-side API
-
Using the high-level server-side API
- Completing, rejecting, or failing routes
- The RequestContext class
- Building out a routing tree
- Using directives to build your routing tree
- Composing directives together
- Marshalling and unmarshalling JSON with spray-json
- Handling rejections within your routes
- Building a custom RejectionHandler
- Testing your routes with route TestKit
- Invoking RESTful APIs with Akka HTTP
- Refactoring homework
- Summary
- 8. Scaling Out with Akka Remoting/Clustering
-
9. Managing Deployments with ConductR
- An overview of ConductR
- Installing and setting up ConductR locally
-
Using the ConductR CLI
- Viewing the ConductR version information
- Viewing the deployed bundle information
- Viewing service information from your bundles
- Viewing access-control lists for bundle services
- Loading a bundle into ConductR
- Starting a bundle within ConductR
- Stopping a bundle within ConductR
- Removing a bundle from ConductR
- Viewing bundle-related events in ConductR
- Viewing your bundle's logs
- Preparing your services for ConductR
- Refactoring the bookstore for ConductR
- Building and deploying the bookstore bundles
- Testing the bookstore modules in ConductR
- Summary
- 10. Troubleshooting and Best Practices
Product information
- Title: Mastering Akka
- Author(s):
- Release date: October 2016
- Publisher(s): Packt Publishing
- ISBN: 9781786465023
You might also like
book
Effective Akka
Avoid common mistakes when building distributed, asynchronous, high-performance software with the Akka toolkit and runtime. With …
video
Akka in Action video edition
"The most readable and up-to-date treatment of Akka I have seen." Kevin Esler, TimeTrade Systems Akka …
book
Akka Cookbook
Learn how to use the Akka framework to build effective applications in Scala About This Book …
book
Akka in Action
Akka in Action is a comprehensive tutorial on building message-oriented systems using Akka. The book takes …