Chapter 5. Routing data with Mule
This chapter covers
- Content-based routing with Mule
- Filtering messages
- Scatter/gather
- Reliability routing
You’ve probably been exposed to a router at some point in your career. Usually these are of the network variety, like the DSL router in your bedroom or a core router in your data center. In either case, the router’s function is the same: to selectively move around data. Not surprisingly, many of the concepts that underlie network routing are also applicable to routing data between applications. You’ll see in this chapter how to route data using Mule.
You’ve already seen an example of routing in chapter 3, where you saw how the choice router uses a message’s payload to determine which execution path it takes. Let’s see how to use Mule’s routers to solve an integration problem.
In listing 3.18 in chapter 3, you saw how Prancing Donkey was dispatching alert notifications to file and JMS endpoints. As it turns out, the majority of the notifications produced by the cooling system are innocuous and don’t require immediate action. Let’s modify the example to only route messages to the JMS queue if they’re of critical importance (see figure 5.1).