@FunctionalInterfaceSE public interface IntegrationFlow
StandardIntegrationFlow 実装(IntegrationFlowBuilder によって生成される)は、アプリケーションコンテキストに登録される統合コンポーネントのコンテナーを表します。通常、@Bean 定義として使用されます。
@Bean
public IntegrationFlow fileReadingFlow() {
return IntegrationFlows
.from(Files.inboundAdapter(tmpDir.getRoot()), e -> e.poller(Pollers.fixedDelay(100)))
.transform(Files.fileToString())
.channel(MessageChannels.queue("fileReadingResultChannel"))
.get();
}
トップレベル定義およびサブフロー定義のラムダとして使用できます。
@Bean
public IntegrationFlow routerTwoSubFlows() {
return f -> f
.split()
.<Integer, Boolean>route(p -> p % 2 == 0, m -> m
.subFlowMapping(true, sf -> sf.<Integer>handle((p, h) -> p * 2))
.subFlowMapping(false, sf -> sf.<Integer>handle((p, h) -> p * 3)))
.aggregate()
.channel(MessageChannels..queue("routerTwoSubFlowsOutput"));
}
また、このインターフェースを直接実装して、ターゲットサービスの統合ロジックをカプセル化することもできます。
@Component
public class MyFlow implements IntegrationFlow {
@Override
public void configure(IntegrationFlowDefinition<?> f) {
f.<String, String>transform(String::toUpperCase);
}
}
IntegrationFlowBuilder, StandardIntegrationFlow, IntegrationFlowAdapter| 修飾子と型 | メソッドと説明 |
|---|---|
void | configure(IntegrationFlowDefinition<?> flow)EIP メソッドのチェーンを宣言して、提供された IntegrationFlowDefinition との統合フローを構成するためのコールバックベースの関数。 |
default MessageChannel | getInputChannel() フロー入力チャネルに不可欠な最初の MessageChannel コンポーネントを返します。 |
void configure(IntegrationFlowDefinition<?> flow)
IntegrationFlowDefinition との統合フローを構成するためのコールバックベースの関数。flow - 構成する IntegrationFlowDefinitiondefault MessageChannel getInputChannel()
MessageChannel コンポーネントを返します。