Chapter 7. Modeling with reactive streams

 

This chapter covers

  • A reminder about the basic design philosophy of reactive streams
  • A complete use case implemented using reactive streams as the backbone
  • Ways to combine other techniques such as the actor model with reactive streams
  • A detailed discussion on using streams to get the basics of reactive modeling

In the preceding chapter, you learned the basic principles of reactive modeling and techniques for making your models responsive and reactive. In this chapter, you’ll take a deep dive into the reactive streams model and an implementation of a use case using Akka Streams. You’ll start from the business requirements, map them into the various stages of stream processing, and implement the components step by step. The use case is from our domain of personal banking and involves handling asynchronous boundaries across bounded contexts; this provides a perfect setting for discussing issues such as reactive socket management and back-pressure handling. And the domain behaviors that we discuss involve data transformations, also suitable for implementation using the streaming model. This chapter covers all aspects of making your model reactive and shows how our implementation addresses each of them.

Figure 7.1 shows a schematic of this chapter’s content. It’s a guide for you to selectively choose your topics as you sail through the chapter.

Figure 7.1. The progression of this chapter’s sections

7.1. The reactive streams model

7.2. When to use the stream model

7.3. The domain use case

7.4. Stream-based domain interaction

7.5. Implementation: front office

7.6. Implementation: back office

7.7. Major takeaways from the stream model

7.8. Making models resilient

7.8.1. Supervision with Akka Streams

7.8.2. Clustering for redundancy

7.8.3. Persistence of data

7.9. Stream-based domain models and the reactive principles

7.10. Summary