Professional Documents
Culture Documents
Spring Integration
Spring Integration
Spring Integration
From the 10,000-foot view, Spring Integration consists of two parts. At its core,
it’s a
messaging framework that supports lightweight, event-driven interactions within an
application. On top of that core, it provides an adapter-based platform that
supports
flexible integration of applications across the enterprise. These two roles are
depicted
in figure 1.1.
The same holds true for Spring Integration. At the lowest level, it has simple
building blocks based on the pipes-and-filters style.As you move up the stack to
more
specialized components, they exhibit the characteristics and perform the roles of
other patterns described in Enterprise Integration Patterns.
Spring Integration aims to provide a clear line between code and configuration.
The components provided by the framework, which often represent the enterprise
integration patterns, are typically configured in a declarative way using either
XML or
Java annotations as metadata. But many of those components act as stereotypes or
templates. They play a role that’s understood by the framework, but they require a
ref-
erence to some user-defined, domain-specific behavior in order to fulfill that
role.
model is determined by the type of channel that’s used for transferring the
messages
between the endpoints. Spring Integration supports both approaches by using two
dif-
ferent types of message channels: DirectChannel (synchronous) and QueueChannel
(asynchronous).
*messaging*
you can use Spring Integration’s
MessageBuilder when you need to create a new Message instance.It should be noted
that the MessageBuilder initializes a num-
ber of headers that are needed by default by the framework, and this is one of the
sig-
nificant advantages of using the MessageBuilder over instantiating messages
directly:
you don’t have to worry about setting up those headers yourself.
The reason no methods are provided for receiving messages is because Spring Inte-
gration differentiates clearly between two mechanisms through which messages are
handed over to the next endpoint—polling and subscription—and provides two dis-
tinct types of channels accordingly.
In Spring Integration, the default channels are SubscribableChannel s, and the mes-
sage transmission is synchronous. The effect is simple: one thread is responsible
for
invoking the three services sequentially, as shown in figure 3.2.