Book Image

Spring Integration Essentials

By : CHANDAN K PANDEY
Book Image

Spring Integration Essentials

By: CHANDAN K PANDEY

Overview of this book

This book is intended for developers who are either already involved with enterprise integration or planning to venture into the domain. Basic knowledge of Java and Spring is expected. For newer users, this book can be used to understand an integration scenario, what the challenges are, and how Spring Integration can be used to solve it. Prior experience of Spring Integration is not expected as this book will walk you through all the code examples.
Table of Contents (12 chapters)
11
Index

Routers

Routers are components that pick messages from a channel and, depending on a set of pre-defined criteria, deliver them to different channels. Routers never change the message—they only route/reroute messages to the next destination. Spring Integration provides the following built-in routers:

  • Payload-type router
  • Header value router
  • Recipient list router
  • XPath router (part of the XML module)
  • Error message exception-type router

Payload-type router

As the name suggests, this router will route the message based on the payload data type. For example, we can have a dedicated channel for string, another one for integer and yet another channel for a user-defined payload type. A simple code snippet from our feeds example is as follows:

<int:payload-type-router input-channel="transformedChannel">
  <int:mapping type="com.cpandey.siexample.pojo.SoFeed" channel="jdbcChannel" />
  <int:mapping type="java.lang.String" channel="jmsChannel...