Chapter 2. Message Routing

In this chapter, we will cover the following recipes:

  • Content Based Routing
  • Filtering out unwanted messages
  • Wire Tap – sending a copy of the message elsewhere
  • Multicast – routing the same message to many endpoints
  • Recipient List – routing a message to a list of endpoints
  • Throttler – restricting the number of messages flowing to an endpoint
  • Request-response route sending a one-way message
  • One-way route waiting on a request-response endpoint
  • Dynamic Routing – making routing decisions at runtime
  • Load balancing across a number of endpoints
  • Routing Slip – routing a message to a fixed list of endpoints

Introduction

This chapter explains how to make use of Camel's built-in EIPs (Enterprise Integration Patterns) to write typical integration logic. Once a message is consumed from an endpoint, you will want to make decisions about what steps should be taken to process it (such as routing), and these EIPs provide you with many different message routing options. The EIPs are used within routes defined by the Camel DSLs (Domain Specific Language).

The EIPs are first class constructs within the DSL. As such, your integration logic will be able to more clearly express how the message is being routed–that is, which EIP is being used. The more you can use these EIP DSL statements within your Camel code, versus doing a lot of routing within custom Java processors, the easier it will be for you and others to understand what the Camel route is doing for future maintenance. This is a key value of Camel, so take full advantage of it within your code, and you will find that you have gained more flexibility and clarity in even the most complex integration scenarios than you ever had with your past custom code efforts.

A number of Camel architectural concepts are used throughout this chapter. There is a broader overview of Camel concepts in the Preface. Full details can be found on the Apache Camel website at http://camel.apache.org.

The code for this chapter is contained within the camel-cookbook-routing module of the examples.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.189.189.67