このバージョンはまだ開発中であり、まだ安定しているとは見なされていません。最新の安定バージョンについては、Spring Integration 6.5.3 を使用してください! |
統合エンドポイント
このセクションでは、外部システムとのメッセージベースの通信をサポートするために、Spring Integration が提供するさまざまなチャネルアダプターとメッセージングゲートウェイについて説明します。
AMQP から Zookeeper までの各システムには独自の統合要件があり、このセクションではそれらについて説明します。
エンドポイントのクイックリファレンステーブル
前のセクションで説明したように、Spring Integration は、外部システム、ファイルシステムなどとのインターフェースに使用される多くのエンドポイントを提供します。
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>7.0.0-RC1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>要点をまとめると:
受信チャネルアダプターは、データをメッセージングアプリケーションに取り込むための一方向統合に使用されます。
送信チャネルアダプターは、メッセージングアプリケーションからデータを送信するための一方向統合に使用されます。
受信ゲートウェイは、他のシステムがメッセージングアプリケーションを呼び出して応答を受信する双方向統合フローに使用されます。
送信ゲートウェイは、メッセージングアプリケーションが外部サービスまたはエンティティを呼び出し、結果を期待する双方向統合フローに使用されます。
次の表は、適切な章へのクイックリンクを使用して、さまざまなエンドポイントをまとめたものです。
| モジュール | 受信アダプター | 送信アダプター | 受信ゲートウェイ | 送信ゲートウェイ |
|---|---|---|---|---|
AMQP | ||||
Apache Camel | N | N | ||
Apache Cassandra | N | N | ||
Debezium | N | N | N | |
イベント | N | N | ||
フィード | N | N | N | |
ファイル | N | |||
FTP(S) | N | |||
GraphQL | N | N | N | |
Hazelcast | N | N | ||
HTTP | ||||
JDBC | N | |||
JMS | ||||
JMX | N | |||
JPA | N | |||
Apache Kafka | ||||
メール | N | N | ||
MongoDB | N | N | ||
MQTT | N | N | ||
R2DBC | N | N | ||
Redis | Redis 受信チャネルアダプター , Redis キュー受信チャネルアダプター , Redis ストア受信チャネルアダプター , Redis ストリーム受信チャネルアダプター | Redis 送信チャネルアダプター , Redis キュー送信チャネルアダプター , RedisStore 送信チャネルアダプター , Redis ストリーム送信チャネルアダプター | ||
リソース | N | N | N | |
RSocket | N | N | ||
SFTP | N | |||
SMB | N | |||
STOMP | N | N | ||
ストリーム | N | N | ||
syslog | N | N | N | |
TCP | ||||
UDP | N | N | ||
WebFlux | ||||
Web サービス | N | N | ||
Web ソケット | N | N | ||
XMPP | N | N | ||
ZeroMQ | N | N |
さらに、コアメッセージングで説明したように、Spring Integration は、Plain Old Java Object(POJO)とのインターフェースのためのエンドポイントを提供します。チャンネルアダプターで説明したように、<int:inbound-channel-adapter> 要素を使用すると、データの Java メソッドをポーリングできます。<int:outbound-channel-adapter> 要素を使用すると、void メソッドにデータを送信できます。メッセージングゲートウェイで説明したように、<int:gateway> 要素により、Java プログラムはメッセージングフローを呼び出すことができます。これらはそれぞれ、Spring Integration のソースレベルの依存関係を必要とせずに機能します。このコンテキストでの送信ゲートウェイに相当するのは、サービスアクティベーター(サービスアクティベーターを参照)を使用して、ある種の Object を返すメソッドを呼び出すことです。
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 a requesting client.