インターフェース IntegrationFlow

すべての既知の実装クラス:
IntegrationFlowAdapterStandardIntegrationFlow
関数インターフェース:
これは関数インターフェースであるため、ラムダ式またはメソッド参照の割り当てターゲットとして使用できます。

@FunctionalInterfaceSE public interface IntegrationFlow
メインの統合 DSL 抽象化。

StandardIntegrationFlow 実装(IntegrationFlowBuilder によって生成される)は、アプリケーションコンテキストに登録される統合コンポーネントのコンテナーを表します。通常、@Bean 定義として使用されます。

  @Bean
  public IntegrationFlow fileReadingFlow() {
      return IntegrationFlow
             .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);
        }

  }
 
導入:
5.0
作成者:
Artem Bilan, Gary Russell, Oleg Zhurakousky, Artem Vozhdayenko
関連事項: