Spring Integration Flow登录出站成功

时间:2018-10-17 10:52:26

标签: spring-integration spring-integration-dsl spring-integration-sftp

如果文件传输成功,如何添加日志。 我想记录文件名,一些值构成我的30b5e8e9151e46be789562580b0118911d875f3d对象

config

更新 加里·罗素(Gary Russell)回答后,我的工作代码是

return IntegrationFlows.from(Sftp.inboundAdapter(inboundSftp)
            .localDirectory(this.getlocalDirectory(config.getId()))
            .deleteRemoteFiles(true)
            .autoCreateLocalDirectory(true)
            .remoteDirectory(config.getInboundDirectory()), e -> e.poller(Pollers.cron("0 */1 * ? * *").errorChannel(MessageHeaders.ERROR_CHANNEL).errorHandler((ex) -> {
        try {

            // exception handling here
    })))
            .handle(Sftp.outboundAdapter(outboundSftp)
                    .useTemporaryFileName(false)
                    .autoCreateDirectory(true)
                    .remoteDirectory(config.getOutboundDirectory()), c -> c.advice(startup.deleteFileAdvice())
            )
            .get();

1 个答案:

答案 0 :(得分:2)

添加带有2个子流的.publishSubscribeChannel()频道。 Docs here

            .publishSubscribeChannel(s -> s
                    .subscribe(f -> f
                            .handle(...)
                    .subscribe(f -> f
                            .log())
相关问题