Examples of RouteDefinition


Examples of org.apache.camel.model.RouteDefinition

     * @param endpoints  the from endpoints
     * @return the builder
     */
    public RouteDefinition from(Endpoint... endpoints) {
        getRouteCollection().setCamelContext(getContext());
        RouteDefinition answer = getRouteCollection().from(endpoints);
        configureRoute(answer);
        return answer;
    }
View Full Code Here

Examples of org.apache.camel.model.RouteDefinition

                new HashMap<ProcessorDefinition, PerformanceCounter>();

        // Each processor in a route will have its own performance counter.
        // These performance counter will be embedded to InstrumentationProcessor
        // and wrap the appropriate processor by InstrumentationInterceptStrategy.
        RouteDefinition route = routeContext.getRoute();

        // register performance counters for all processors and its children
        for (ProcessorDefinition processor : route.getOutputs()) {
            registerPerformanceCounters(routeContext, processor, registeredCounters);
        }

        // set this managed intercept strategy that executes the JMX instrumentation for performance metrics
        // so our registered counters can be used for fine grained performance instrumentation
View Full Code Here

Examples of org.apache.camel.model.RouteDefinition

            String id = route.getId();

            Iterator<KeyValueHolder<ProcessorDefinition, InstrumentationProcessor>> it = wrappedProcessors.values().iterator();
            while (it.hasNext()) {
                KeyValueHolder<ProcessorDefinition, InstrumentationProcessor> holder = it.next();
                RouteDefinition def = ProcessorDefinitionHelper.getRoute(holder.getKey());
                if (def != null && id.equals(def.getId())) {
                    it.remove();
                }
            }
        }
       
View Full Code Here

Examples of org.apache.camel.model.RouteDefinition

    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;
View Full Code Here

Examples of org.apache.camel.model.RouteDefinition

        // id is mandatory
        ObjectHelper.notEmpty(id, "id for thread pool " + executorService);

        // extract route id if possible
        if (source instanceof ProcessorDefinition) {
            RouteDefinition route = ProcessorDefinitionHelper.getRoute((ProcessorDefinition) source);
            if (route != null) {
                routeId = route.idOrCreate(this.camelContext.getNodeIdFactory());
            }
        }

        // let lifecycle strategy be notified as well which can let it be managed in JMX as well
        ThreadPoolExecutor threadPool = null;
View Full Code Here

Examples of org.apache.camel.model.RouteDefinition

    public void testNavigateRouteAsJavaDSL() throws Exception {
        // this one navigate using the route definition

        StringBuilder sb = new StringBuilder();

        RouteDefinition route = context.getRouteDefinitions().get(0);

        // the start of the route
        sb.append("from(\"" + route.getInputs().get(0).getUri() + "\")");

        // navigate the route and add Java DSL to the sb
        navigateDefinition(route, sb);

        // output the Java DSL
View Full Code Here

Examples of org.apache.camel.model.RouteDefinition

        }

        // can either be routes or a single route
        RoutesDefinition answer = null;
        if (result instanceof RouteDefinition) {
            RouteDefinition route = (RouteDefinition) result;
            answer = new RoutesDefinition();
            answer.getRoutes().add(route);
        } else if (result instanceof RoutesDefinition) {
            answer = (RoutesDefinition) result;
        } else {
View Full Code Here

Examples of org.apache.camel.model.RouteDefinition

     */
    protected boolean removeRouteDefinition(String key) {
        boolean answer = false;
        Iterator<RouteDefinition> iter = routeDefinitions.iterator();
        while (iter.hasNext()) {
            RouteDefinition route = iter.next();
            if (route.idOrCreate(nodeIdFactory).equals(key)) {
                iter.remove();
                answer = true;
            }
        }
        return answer;
View Full Code Here

Examples of org.apache.camel.model.RouteDefinition

        List<Class<? extends Throwable>> list = exceptionType.getExceptionClasses();
        for (Class<? extends Throwable> clazz : list) {
            String routeId = null;
            // only get the route id, if the exception type is route scoped
            if (exceptionType.isRouteScoped()) {
                RouteDefinition route = ProcessorDefinitionHelper.getRoute(exceptionType);
                if (route != null) {
                    routeId = route.getId();
                }
            }
            ExceptionPolicyKey key = new ExceptionPolicyKey(routeId, clazz, exceptionType.getOnWhen());
            exceptionPolicies.put(key, exceptionType);
        }
View Full Code Here

Examples of org.apache.camel.model.RouteDefinition

            assertEquals(route, output.getParent());
        }
    }

    public void testAddRouteDefinitionsFromXml3() throws Exception {
        RouteDefinition route = loadRoute("route3.xml");
        assertNotNull(route);

        assertEquals("foo", route.getId());
        assertEquals(0, context.getRoutes().size());

        context.addRouteDefinition(route);
        assertEquals(1, context.getRoutes().size());
        assertTrue("Route should be started", context.getRouteStatus("foo").isStarted());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.