第 386 章 Master RoutePolicy
您还可以使用 RoutePolicy
来控制 master/slave 模式中的路由。
在这样做时,您必须使用
- zookeeper ensemble 的 URL
- 集群组群名称
- 重要 并将路由设置为不自动启动
一个例子
MasterRoutePolicy master = new MasterRoutePolicy(); master.setZooKeeperUrl("localhost:2181"); master.setGroupName("myGroup"); // its import to set the route to not auto startup // as we let the route policy start/stop the routes when it becomes a master/slave etc from("file:target/inbox?delete=true").noAutoStartup() // use the zookeeper master route policy in the clustered group // to run this route in master/slave mode .routePolicy(master) .log(name + " - Received file: ${file:name}") .delay(delay) .log(name + " - Done file: ${file:name}") .to("file:target/outbox");
386.1. 另请参阅
- 配置 Camel
- 组件
- 端点
- 开始使用