【发布时间】:2022-02-04 01:21:40
【问题描述】:
我的用例基于我需要从不同的源系统获取或移动文件到目标系统的其余控制器输入。
路线:-
@Component
public class MoveFile extends RouteBuilder {
@override
public void configure() throws Exception {
from("file:tmp/${header.inPath}")
.to("file:/tmp${header.outPath}?fileName=${header.fileName}")
.setBody().constant("File - ${header.inPath}/${header.fileName} Moved Succesfully")
}
}
我的休息控制器将沿 getMapping 传递 jobName 以调用此特定路由 inPath 、 outPath 和文件名
@Resource(name=RouteProperties)
private Prosperties props;
@GetMapping("/runJob/{jobToInvoke}")
public String runJob (@PathVariable final String jobToInvoke){
String inPath=props.getProperty("inPath"+jobToInvoke)
String outPath=props.getProperty("outPath"+jobToInvoke)
String fileName=props.getProperty("fileName"+jobToInvoke)
String jobStatus = ProducerTemplate.withHeader("inPath",inPath)
.
.
.to(??)
.request(String.class)
}
我需要帮助才能使用 Producer Template 来传递使用 to 的属性? 我在谷歌上尝试了一些搜索,但在 youtube (link) 中有一个示例,但在那个视频中它正在调用 uri , (Direct:sendMessage) 并且从路线中也有。 在这种情况下如何处理? 提前致谢
【问题讨论】:
标签: apache-camel spring-batch spring-camel