2 Routing with Camel

 

This chapter covers

  • An overview of routing
  • Introducing the Rider Auto Parts scenario
  • The basics of FTP and JMS endpoints
  • Creating routes using the Java DSL
  • Configuring routes in XML
  • Routing using EIPs

One of the most important features of Camel is routing; without it, Camel would be a library of transport connectors. In this chapter, you’ll dive into routing with Camel.

Routing happens in many aspects of everyday life. When you mail a letter, for instance, it may be routed through several cities before reaching its final address. An email you send will be routed through many computer network systems before reaching its final destination. In all cases, the router’s function is to selectively move the message forward.

In the context of enterprise messaging systems, routing is the process by which a message is taken from an input queue and, based on a set of conditions, sent to one of several output queues, as shown in figure 2.1. The input and output queues are unaware of the conditions in between them. The conditional logic is decoupled from the message consumer and producer.

Figure 2.1 A message router consumes messages from an input channel and, depending on a set of conditions, sends the message to one of a set of output channels.

c02_01.png

2.1 Introducing Rider Auto Parts

2.2 Understanding endpoints

2.2.1 Consuming from an FTP endpoint

2.2.2 Sending to a JMS endpoint

2.3 Creating routes in Java

2.3.1 Using RouteBuilder

2.3.2 Using the Java DSL

2.4 Defining routes in XML

2.4.1 Bean injection and Spring

2.4.2 The XML DSL

2.4.3 Using Camel and Spring

2.5 Endpoints revisited

2.5.1 Sending to dynamic endpoints

2.5.2 Using property placeholders in endpoint URIs

2.5.3 Using raw values in endpoint URIs

2.5.4 Referencing registry beans in endpoint URIs

2.6 Routing and EIPs

2.6.1 Using a content-based router

2.6.2 Using message filters

2.6.3 Using multicasting

2.6.4 Using recipient lists

2.6.5 Using the wireTap method

2.7 Summary and best practices

sitemap