27 Eylül 2018 Perşembe

SpringIntegration MessageChannels Sınıfı

publishSubscriber metodu
Örnek
Şöyle yaparız.
@Configuration
public class FTPIntegration {


  @Bean
  public MessageChannel outputIntegrationChannel(ErrorHandler errorHandler) {
    return MessageChannels
            .publishSubscribe()
            .errorHandler(errorHandler)
            .get();
  }

  @Bean
  public IntegrationFlow ftpIntegration(ErrorHandler errorHandler,
    MessageHandler messageHandler) {
    return IntegrationFlows
            .from(outputIntegrationChannel(errorHandler))
            .transform(Transformers.toJson())
            .handle(messageHandler)
            .get();
  }
}
Örnek
Şöyle yaparız.
@Bean(name = {"publishCha.input", "publishCha2.input"}) //2 subscribers
public MessageChannel publishAction() {
  PublishSubscribeChannel ps = MessageChannels.publishSubscribe().get();
  ps.setMaxSubscribers(8);
  return ps;
}

Hiç yorum yok:

Yorum Gönder