Spring Integration中无法使RequestHandlerRetryAdvice与Ftp.outboundGateway一起使用

Spring Integration中无法使RequestHandlerRetryAdvice与Ftp.outboundGateway一起使用,第1张

Spring Integration中无法使RequestHandlerRetryAdvice与Ftp.outboundGateway一起使用

抱歉耽搁了; 我们这周在SpringOne平台上。

问题是由于网关规范是一个bean的事实-网关最终在应用建议之前被初始化。

我这样更改了您的代码…

@Beanpublic IntegrationFlow downloadFiles(SessionFactory<FTPFile> sessionFactory) {    return f -> f.handle(getRemoteFile(sessionFactory), getRetryAdvice()) .channel("gatewayDownloadsOutputChannel");}...private RemoteFileOutboundGatewaySpec<FTPFile, FtpOutboundGatewaySpec> getRemoteFile(SessionFactory<FTPFile> sessionFactory) {    return Ftp.outboundGateway(sessionFactory, AbstractRemoteFileOutboundGateway.Command.GET, "payload") .fileExistsMode(FileExistsMode.REPLACE) .localDirectoryexpression("'/tmp'") .autoCreateLocalDirectory(true);}

…而且有效。

通常最好不要直接处理Specs,而只是将它们内联到流定义中…

@Beanpublic IntegrationFlow downloadFiles(SessionFactory<FTPFile> sessionFactory) {    return f -> f.handle(Ftp.outboundGateway(sessionFactory, AbstractRemoteFileOutboundGateway.Command.GET, "payload") .fileExistsMode(FileExistsMode.REPLACE) .localDirectoryexpression("'/tmp'") .autoCreateLocalDirectory(true), getRetryAdvice())        .channel("gatewayDownloadsOutputChannel");}


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5122743.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-17
下一篇 2022-11-17

发表评论

登录后才能评论

评论列表(0条)

保存