Chapter 9. Routing messages
In this chapter
- Using the enterprise integration router pattern
- Scaling with Akka routers
- Building a state-based router with become/unbecome
In the previous chapter we looked at enterprise integration patterns as a way to connect actors to solve a wide range of problems. Yet all those approaches involved processing incoming messages in the same way. But often, you need to handle messages differently.
Routers are essential when you want to scale up or out. For example, when you want to scale up, you need multiple instances of the same task, and routers will decide which instance will process the received message. We’ll start this chapter by describing the enterprise router pattern and examine the three reasons for using routing to control message flow:
- Performance
- Message content
- State
We’ll then show you how to create routing processes for each of these patterns.