3. Adapters

3.1 Introduction

Spring Integration provides a number of implementations of the Source and Target interfaces that serve as adapters for interacting with external systems or components that are not part of the messaging system. Configuring these source and target implementations within SourceEndpoints and TargetEndpoints provides an implementation of the Channel Adapter pattern. Essentially, the external system or component sends-to and/or receives-from a MessageChannel. In the 1.0 Milestone 4 release, Spring Integration includes source and target implementations for JMS, RMI, Files, Streams, Spring's HttpInvoker and Spring ApplicationEvents. A source adapter for FTP is also available as well as target adapters for sending e-mail and invoking Web Services.

Adapters that allow the external system to perform request-reply operations across Spring Integration MessageChannels are actually examples of the Messaging Gateway pattern. Therefore, those implementations are typically called "gateways". For example, Spring Integration provides a JmsSource that is polled by the bus-managed scheduler, but it also provides a JmsGateway. The gateway differs from the source in that it is an event-driven consumer rather than a polling consumer, and it is capable of waiting for reply messages.

All of these adapters are discussed in this section. However, namespace support is provided for many of them and is typically the most convenient option for configuration. For examples, see the section called “Configuring Adapters”.