【发布时间】:2018-01-19 12:43:48
【问题描述】:
我在使用 DSL 的 SFTP 出站网关方面遇到问题。 我想使用出站网关发送文件,然后继续我的流程。 问题是我有一个异常告诉我:
IllegalArgumentException: 'remoteDirectoryExpression' is required
我看到我可以使用 RemoteFileTemplate 来设置 sftp 会话工厂和远程目录信息,但是我不需要的目录是在我的流程中由在启动之前放在标题中的代码定义的批。
@Bean
public IntegrationFlow orderServiceFlow() {
return f -> f
.handleWithAdapter(h -> h.httpGateway("myUrl")
.httpMethod(HttpMethod.GET)
.expectedResponseType(List.class)
)
.split()
.channel(batchLaunchChannel());
}
@Bean
public DirectChannel batchLaunchChannel() {
return MessageChannels.direct("batchLaunchChannel").get();
}
@Bean
public IntegrationFlow batchLaunchFlow() {
return IntegrationFlows.from(batchLaunchChannel())
.enrichHeaders(h -> h
.headerExpression("oiCode", "payload")
)
.transform((GenericTransformer<String, JobLaunchRequest>) message -> {
JobParameters jobParameters = new JobParametersBuilder()
.addDate("exec_date", new Date())
.addString("oiCode", message)
.toJobParameters();
return new JobLaunchRequest(orderServiceJob, jobParameters);
})
.handle(new JobLaunchingMessageHandler(jobLauncher))
.enrichHeaders(h -> h
.headerExpression("jobExecution", "payload")
)
.handle((p, h) -> {
//Logic to retreive file...
return new File("");
})
.handle(Sftp.outboundGateway(sftpSessionFactory,
AbstractRemoteFileOutboundGateway.Command.PUT,
"payload")
)
.get();
}
我不知道如何告诉我的出站网关哪个是目录,具体取决于我的标题中的内容。
【问题讨论】:
标签: spring-integration sftp dsl