【发布时间】:2017-04-01 07:14:51
【问题描述】:
我是 Camel 的新手,我使用简单的表达式从 Java DSL 中的属性文件中获取值。
.setProperty("PortalUrl", simple("properties:Portal.url"))
属性文件值 -Portal.url=abc.com/example
但是现在我需要从属性文件中获取客户特定的 URL。 示例值 -
Portal.url.customer1=abc.com/example/abcd
Portal.url.customer2=abc.com/example/xyz
客户名称来自请求本身,所以我想这样做.setProperty("PortalUrl", simple("properties:Portal.url."+"${body.customerName}"))
但上面的代码不起作用,它给了我 PortalUrl 属性的值为properties:Portal.ulr.customer1
当我尝试使用直接硬编码值时,它会从属性文件中给我正确的 URL -
.setProperty("PortalUrl", simple("properties:Portal.url."+"customer1"))
它返回了正确的值 - abc.com/example/abcd
但我想动态获取 URL 作为传入请求中的客户名称。 任何人都可以帮助我,并解释简单的工作原理。
【问题讨论】:
标签: apache-camel