【发布时间】:2020-04-30 20:12:24
【问题描述】:
我正在尝试使用 Apache Camel 处理文件,处理后将其移动到特定文件夹,同时保留文件名和目录结构。
我在 application.yml 文件中的内容:
camel-from: "file:/C:/in/received?move=../in/processed/${file:name}&recursive=true&readLock=changed&readLockMarkerFile=false&delay=1000&maxDepth=2&minDepth=2"
使用Java的Route如下:
@Component
@RequiredArgsConstructor
public class TestRoute extends RouteBuilder {
@Value("${camel-from}")
private String fromUri;
@Override
public final void configure() {
from(fromUri)
// rest of code
}
}
如果我直接在路由中使用字符串,它工作得很好。但是,从 application.yml 文件中读取它,无论我尝试转义哪些字符,我都无法正确读取 uri。 (我总是以错误告终,或者创建诸如处理/名称之类的文件夹,而不是解释 ${file:name})。
有什么想法吗?
谢谢
【问题讨论】:
-
这看起来像spring-framework#9628。您可以尝试使用
move=../in/processed/#{'$'}{file:name}或该问题中的其他建议吗? -
谢谢,成功了!
标签: apache-camel yaml dsl spring-camel