我有两个程序,由三个路线组成。
[
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("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");
最佳答案
您不需要基于内容的路由来控制路由是否启动...
只需使用autoStartup(boolean)
API 来控制此...
例如...
from("activemq:queue:special").autoStartup("{{startupRouteProperty}}").to("file://backup");
参见http://camel.apache.org/configuring-route-startup-ordering-and-autostartup.html
关于java - 不同形式的 Camel : Content based routing,,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26842909/