搜索

第 387 章 Master RoutePolicy

download PDF

您还可以使用 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");

387.1. 另请参阅

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.