25 Aralık 2019 Çarşamba

SpringIntegration IntegrationFlowBuilder

Örnek - Consumer
Şöyle yaparız.
@Bean
public IntegrationFlow lines(FileWritingMessageHandler fileOut) {
  return f -> f.handle(fileOut);
}
publishSubscribeChannel metodu
Açıklaması şöyle.
The publishSubscribeChannel() method broadcasts messages to all subscribing subflows.
...
In this way, the subflows are anonymous, meaning that they can't be independently addressed.
Örnek - Consumer + Producer
Şöyle yaparız.
@Bean
public IntegrationFlow markers() {
   return f -> f.<FileSplitter.FileMarker>filter(m ->...,...)
          .publishSubscribeChannel(s -> s
                  // first trigger file flushes
              .subscribe(...)
                   // send the first file
              .subscribe(...)
                   // send the second file
               .subscribe(...)
                   // send the third file
               .subscribe(...)
                   // send an email
               .subscribe(...));
}

Hiç yorum yok:

Yorum Gönder