386장. Master RoutePolicy

RoutePolicy 를 사용하여 마스터/슬레이브 모드의 경로를 제어할 수도 있습니다.

이렇게 할 때 다음을 사용하여 경로 정책을 구성해야 합니다.

  • zookeeper Ensemble
  • 클러스터 그룹의 이름
  • 중요하며 자동 시작하지 않도록 경로를 설정합니다.

약간의 예

    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 구성
  • 구성 요소
  • 끝점
  • 시작하기