284.5.3. 2 단계 : routebox 소비자 시작

경로 소비자를 생성할 때 routeboxUri의 # 항목이 CamelContext 레지스트리의 생성된 내부 레지스트리, routebuilder 목록 및 dispatchStrategy/dispatchMap과 일치합니다. 모든 routebuilder 및 관련 경로는 routebox 생성 내부 컨텍스트에서 시작됩니다.

private String routeboxUri = "routebox:multipleRoutes?innerRegistry=#registry&routeBuilders=#routes&dispatchMap=#map";

public void testRouteboxRequests() throws Exception {
    CamelContext context = createCamelContext();
    template = new DefaultProducerTemplate(context);
    template.start();

    context.addRoutes(new RouteBuilder() {
        public void configure() {
            from(routeboxUri)
                .to("log:Routes operation performed?showAll=true");
        }
    });
    context.start();

    // Now use the ProducerTemplate to send the request to the routebox
    template.requestBodyAndHeader(routeboxUri, book, "ROUTE_DISPATCH_KEY", "addToCatalog");
}