apache-camel - 如何修复文本中缺少 ${:错误 - Apache Camel 2.12 到 2.16.4 升级
问题描述
我们正在从 Apache Camel 2.12 升级到 2.16.4,并且遇到了其中一条路线的问题。
Caused by: java.lang.IllegalArgumentException: Missing ${ from the text: file:C:\OnDemandOutput?fileName=RPFPos_L2W.$simple{in.header.accountNum}-${date:now:yyyyMMddHHmmssSSS}.csv
<camelContext xmlns="http://camel.apache.org/schema/spring">
<propertyPlaceholder id="ignoreId" location="classpath:reformMB.properties"
prefixToken="${" suffixToken="}"/>
<route id="sendNotification">
<from uri="jms:queue:queue.sendNotification"/>
<to uri="file:${OnDemand.output.url}?fileName=RPFPos_L2W.$simple{in.header.accountNum}-${date:now:yyyyMMddHHmmssSSS}.csv"/>
</route>
</camelContext>
根据文档,这应该有效。有人可以帮我理解什么是错的吗?
根据官方文档,应该可以使用$simple{...}
如下方式引用 Camel 的属性:
用 Camels 简单语言冲突 Spring 属性占位符
使用 Spring 桥接占位符时要注意,然后 spring ${} 语法与 Camel 中的 Simple 发生冲突,因此要小心。
例子:
<setHeader headerName="Exchange.FILE_NAME"> <simple>{{file.rootdir}}/${in.header.CamelFileName}</simple> </setHeader>
与 Spring 属性占位符冲突,您应该使用
$simple{}
Camel 中的 Simple 语言来指示。<setHeader headerName="Exchange.FILE_NAME"> <simple>{{file.rootdir}}/$simple{in.header.CamelFileName}</simple </setHeader>
解决方案
推荐阅读
- reactjs - 从屏幕 B 导航到 A 时防止卸载
- vue.js - 如何从结果axios中获取所有数据?
- sql - 基于 SQL 中 JSON 集形式的唯一 ID 合并行
- python - 通过 API 上传到 Dropbox 的文件是二进制的
- r - 使用R中for循环中的if语句将一组字符串折叠成一个字符串
- reactjs - Input Type=Date 不显示初始化值
- c++ - 使用代理对象延迟更新与“使用自定义构造和销毁避免未命名对象”
- android - 如何在 Retrofit2 中传递承载 API 密钥?
- javascript - 查明最后一个站点是否与原点相同
- kotlin - 如何在 Kotlin 中按字母顺序对字符串进行排序