Package org.apache.camel

Examples of org.apache.camel.Route


        }

        if (startInputs) {
            // start the input consumers
            for (Map.Entry<Route, Consumer> entry : inputs.entrySet()) {
                Route route = entry.getKey();
                Consumer consumer = entry.getValue();
                startChildService(route, consumer);
            }
        }
    }
View Full Code Here


            InstrumentationProcessor wrapper = new InstrumentationProcessor();
            wrapper.setType("route");
            wrapper.setProcessor(target);

            // and create the route that wraps the UoW
            Route edcr = new EventDrivenConsumerRoute(this, getEndpoint(), wrapper);
            edcr.getProperties().put(Route.ID_PROPERTY, route.idOrCreate(getCamelContext().getNodeIdFactory()));
            edcr.getProperties().put(Route.PARENT_PROPERTY, Integer.toHexString(route.hashCode()));
            if (route.getGroup() != null) {
                edcr.getProperties().put(Route.GROUP_PROPERTY, route.getGroup());
            }

            // after the route is created then set the route on the policy processor so we get hold of it
            if (routePolicyProcessor != null) {
                routePolicyProcessor.setRoute(edcr);
View Full Code Here

    public void setCamelController(CamelController camelController) {
        this.camelController = camelController;
    }

    public Object doExecute() throws Exception {
        Route camelRoute = camelController.getRoute(route, context);
        if (camelRoute == null) {
            System.err.println("Camel route " + route + " not found.");
            return null;
        }
        CamelContext camelContext = camelRoute.getRouteContext().getCamelContext();
        camelContext.suspendRoute(route);
        return null;
    }
View Full Code Here

    public void setCamelController(CamelController camelController) {
        this.camelController = camelController;
    }

    public Object doExecute() throws Exception {
        Route camelRoute = camelController.getRoute(route, context);
        if (camelRoute == null) {
            List<CamelContext> camelContexts = camelController.getCamelContexts();
            for (CamelContext camelContext : camelContexts) {
                RouteDefinition routeDefinition = camelContext.getRouteDefinition(route);
                if (routeDefinition != null) {
                    camelContext.startRoute(routeDefinition.getId());
                    return null;
                }
            }
            System.err.println("Camel route " + route + " not found.");
            return null;
        } else {
            CamelContext camelContext = camelRoute.getRouteContext().getCamelContext();
            camelContext.startRoute(route);
        }
        return null;
    }
View Full Code Here

    public void setCamelController(CamelController camelController) {
        this.camelController = camelController;
    }

    public Object doExecute() throws Exception {
        Route camelRoute = camelController.getRoute(route, context);
        if (camelRoute == null) {
            System.err.println("Camel route " + route + " not found.");
            return null;
        }
        CamelContext camelContext = camelRoute.getRouteContext().getCamelContext();
        camelContext.resumeRoute(route);
        return null;
    }
View Full Code Here

       
        template.sendBody("direct:start", "Hello World");

        assertMockEndpointsSatisfied();

        Route route = context.getRoutes().get(0);
        assertNotNull("The route should not be null", route);

        // TODO: drill down the route and check that Channel have
        // the fine grained processor definition assigned
        // this also helps the tracer as it now can better pin point it exact location
View Full Code Here

    protected void doTestStreamResequencerType() throws Exception {
        List<Route> list = getRouteList(createRouteBuilder());
        assertEquals("Number of routes created: " + list, 1, list.size());

        Route route = list.get(0);
        EventDrivenConsumerRoute consumerRoute = assertIsInstanceOf(EventDrivenConsumerRoute.class, route);

        Channel channel = unwrapChannel(consumerRoute.getProcessor());

        assertIsInstanceOf(DefaultErrorHandler.class, channel.getErrorHandler());
View Full Code Here

    public void testBatchResequencerTypeWithoutJmx() throws Exception {
        List<Route> list = getRouteList(createRouteBuilder());
        assertEquals("Number of routes created: " + list, 1, list.size());

        Route route = list.get(0);
        EventDrivenConsumerRoute consumerRoute = assertIsInstanceOf(EventDrivenConsumerRoute.class, route);

        DefaultChannel channel = assertIsInstanceOf(DefaultChannel.class, unwrapChannel(consumerRoute.getProcessor()));

        assertIsInstanceOf(DefaultErrorHandler.class, channel.getErrorHandler());
View Full Code Here

    public void testNavigateRouteAsJavaDSLWithNavigate() throws Exception {
        // this one navigate using the runtime route using the Navigate<Processor>

        StringBuilder sb = new StringBuilder();

        Route route = context.getRoutes().get(0);

        // the start of the route
        sb.append("from(\"" + route.getEndpoint().getEndpointUri() + "\")");

        // navigate the route and add Java DSL to the sb
        Navigate<Processor> nav = route.navigate();
        navigateRoute(nav, sb);

        // output the Java DSL
        assertEquals("from(\"direct://start\").loadBalance().random().to(\"mock://x\").to(\"mock://y\").to(\"mock://z\")", sb.toString());
    }
View Full Code Here

                from("direct:start").routeId("coolRoute").to("mock:result");
            }
        });
        ctx.start();

        Route route = ctx.getRoute("coolRoute");
        assertNotNull(route);
        assertEquals("coolRoute", route.getId());
        assertEquals("direct://start", route.getConsumer().getEndpoint().getEndpointUri());

        assertNull(ctx.getRoute("unknown"));
    }
View Full Code Here

TOP

Related Classes of org.apache.camel.Route

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.