【发布时间】:2014-11-10 11:35:58
【问题描述】:
我有两个程序,由三个路线组成。
[
one is a route, from JPA database to bean.
one is a copier, from file system endpoint to file system endpoint
]
[
one is a uploader, from file system endpoint to bean.
]
我想根据我的属性文件的输入运行一个程序
<context:property-placeholder location="./run.properties"
ignore-resource-not-found="false" />
但对于基于内容的路由,我所能找到的只是选择位于 from 下方的示例。例如。
from("direct:start")
.choice()
.when(body().contains("Camel"))
.loadBalance().roundRobin().to("mock:foo").to("mock:bar")
.otherwise()
.to("mock:result");
我想要一种重新排列的方法,如下所示:
choice()
.when(body().contains("Camel"))
from("direct:start1").loadBalance().roundRobin().to("mock:foo").to("mock:bar")
.otherwise()
from("direct:start2").to("mock:result");
【问题讨论】:
-
你想要什么?你想根据属性开始不同的路线吗?
-
没错。我想有某种 Spring EL 可以处理这个问题,但我找不到。
-
如果您使用 Java DSL (camel.apache.org/java-dsl.html),您可以通过编程方式启动路由。简单的方法是读取属性并在路由中写入 if else 语句。
-
好的,谢谢,这行得通。
-
如果它有效,请发布您自己的问题答案。
标签: java apache-camel apache-karaf fuseesb