This section covers the various channel adapters and messaging gateways provided by Spring Integration to support message-based communication with external systems.

Each system, from AMQP to Zookeeper, has its own integration requirements, and this section covers them.

Endpoint Quick Reference Table

As discussed in the earlier sections, Spring Integration provides a number of endpoints used to interface with external systems, file systems, and others.

For transparent dependency management Spring Integration provides a bill-of-materials POM to be imported into the Maven configuration:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.integration</groupId>
            <artifactId>spring-integration-bom</artifactId>
            <version>5.3.7.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

To recap:

  • Inbound channel adapters are used for one-way integration to bring data into the messaging application.

  • Outbound channel adapters are used for one-way integration to send data out of the messaging application.

  • Inbound gateways are used for a bidirectional integration flow, where some other system invokes the messaging application and receives a reply.

  • Outbound Gateways are used for a bidirectional integration flow, where the messaging application invokes some external service or entity and expects a result.

The following table summarizes the various endpoints with quick links to the appropriate chapter.

Table 1. Endpoint Quick Reference
Module Inbound Adapter Outbound Adapter Inbound Gateway Outbound Gateway

AMQP

Inbound Channel Adapter

Outbound Channel Adapter

Inbound Gateway

Outbound Gateway

Events

Receiving Spring Application Events

Sending Spring Application Events

N

N

Feed

Feed Inbound Channel Adapter

N

N

N

File

Reading Files and 'tail’ing Files

Writing files

N

Writing files

FTP(S)

FTP Inbound Channel Adapter

FTP Outbound Channel Adapter

N

FTP Outbound Gateway

Gemfire

Inbound Channel Adapter and Continuous Query Inbound Channel Adapter

Outbound Channel Adapter

N

N

HTTP

HTTP Namespace Support

HTTP Namespace Support

Http Inbound Components

HTTP Outbound Components

JDBC

Inbound Channel Adapter and Stored Procedure Inbound Channel Adapter

Outbound Channel Adapter and Stored Procedure Outbound Channel Adapter

N

Outbound Gateway and Stored Procedure Outbound Gateway

JMS

Inbound Channel Adapter and Message-driven Channel Adapter

Outbound Channel Adapter

Inbound Gateway

Outbound Gateway

JMX

Notification-listening Channel Adapter and Attribute-polling Channel Adapter and Tree-polling Channel Adapter

Notification-publishing Channel Adapter and Operation-invoking Channel Adapter

N

Operation-invoking Outbound Gateway

JPA

Inbound Channel Adapter

Outbound Channel Adapter

N

Updating Outbound Gateway and Retrieving Outbound Gateway

Mail

Mail-receiving Channel Adapter

Mail-sending Channel Adapter

N

N

MongoDB

MongoDB Inbound Channel Adapter

MongoDB Outbound Channel Adapter

N

N

MQTT

Inbound (Message-driven) Channel Adapter

Outbound Channel Adapter

N

N

Redis

Redis Inbound Channel Adapter and Redis Queue Inbound Channel Adapter and Redis Store Inbound Channel Adapter

Redis Outbound Channel Adapter and Redis Queue Outbound Channel Adapter and RedisStore Outbound Channel Adapter

Redis Queue Inbound Gateway

Redis Outbound Command Gateway and Redis Queue Outbound Gateway

Resource

Resource Inbound Channel Adapter

N

N

N

RMI

N

N

Inbound RMI

Outbound RMI

RSocket

N

N

RSocket Inbound Gateway

RSocket Outbound Gateway

SFTP

SFTP Inbound Channel Adapter

SFTP Outbound Channel Adapter

N

SFTP Outbound Gateway

STOMP

STOMP Inbound Channel Adapter

STOMP Outbound Channel Adapter

N

N

Stream

Reading from Streams

Writing to Streams

N

N

Syslog

Syslog Inbound Channel Adapter

N

N

N

TCP

TCP Adapters

TCP Adapters

TCP Gateways

TCP Gateways

UDP

UDP Adapters

UDP Adapters

N

N

WebFlux

WebFlux Inbound Channel Adapter

WebFlux Outbound Channel Adapter

Inbound WebFlux Gateway

Outbound WebFlux Gateway

Web Services

N

N

Inbound Web Service Gateways

Outbound Web Service Gateways

Web Sockets

WebSocket Inbound Channel Adapter

WebSocket Outbound Channel Adapter

N

N

XMPP

XMPP Messages and XMPP Presence

XMPP Messages and XMPP Presence

N

N

In addition, as discussed in Core Messaging, Spring Integration provides endpoints for interfacing with Plain Old Java Objects (POJOs). As discussed in Channel Adapter, the <int:inbound-channel-adapter> element lets you poll a Java method for data. The <int:outbound-channel-adapter> element lets you send data to a void method. As discussed in Messaging Gateways, the <int:gateway> element lets any Java program invoke a messaging flow. Each of these works without requiring any source-level dependencies on Spring Integration. The equivalent of an outbound gateway in this context is using a service activator (see Service Activator) to invoke a method that returns an Object of some kind.

Starting with version 5.2.2, all the inbound gateways can be configured with an errorOnTimeout boolean flag to throw a MessageTimeoutException when the downstream flow doesn’t return a reply during the reply timeout. The timer is not started until the thread returns control to the gateway, so usually it is only useful when the downstream flow is asynchronous or it stops because of a null return from some handler, e.g. filter. Such an exception can be handled on the errorChannel flow, e.g. producing a compensation reply for requesting client.