Spring Integration provides a number of implementations of the MessageSource
and MessageTarget
interfaces that serve as adapters for interacting with
external systems or components that are not part of the messaging system. These source and target
implementations can be configured within the same channel-adapter element that we
have already discussed. Essentially, the external system or component sends-to and/or receives-from a
MessageChannel
. In the 1.0 Milestone 6 release, Spring Integration includes
source and target implementations for JMS, Files, FTP, Streams, and Spring ApplicationEvents.
Adapters that allow an 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" (whereas "source" and "target"
are in-only and out-only interactions respectively). For example, Spring Integration provides a
JmsSource
that is polled by the bus-managed scheduler, but
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. Spring Integration also provides gateways for RMI and
Spring's HttpInvoker.
Finally, adapters that enable interaction with external systems by invoking them for
request/reply interactions (the response is sent back on a Message Channel) are typically called
handlers in Spring Integration, since they implement the
MessageHandler
interface. Basically, these types of adapters can be
configured exactly like any POJO with the <service-activator> element. Spring Integration provides
RMI, HttpInvoker, and Web Service handler implementations.
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 Section 4.2.4, “Configuring Adapters”.