This chapter covers
- Introduction to reactive domain models
- Reactive API design using futures and promises
- Reactive communication between bounded contexts using asynchronous messaging
- The stream model with example implementations from Akka Streams
- The actor model of communication
So far you’ve learned about the virtues of functional programming and how to apply these principles when you design a domain model. This chapter starts the discussion of how to make your functional domain model reactive. You want your model to be responsive to users, elastic for scalability, resilient to failures, and decoupled in time and space using message-driven architectures.[1] This chapter covers various ways of being reactive with domain models built using Scala. You’ll take a step up from the low-level concurrency primitives such as threads and semaphores and use higher-order abstractions that Scala offers. These include designing APIs using futures and promises, implementing loosely coupled architectures with asynchronous messaging, building stream pipelines, and finally using the actor model that also provides fault tolerance and redundancy.
Figure 6.1 shows a schematic of this chapter’s topics. This guide will help you selectively choose your topics as you sail through the chapter.