Examples of RoutePolicy


Examples of org.apache.camel.spi.RoutePolicy

        }
        if (routePolicyRef != null) {
            StringTokenizer policyTokens = new StringTokenizer(routePolicyRef, ",");
            while (policyTokens.hasMoreTokens()) {
                String ref = policyTokens.nextToken().trim();
                RoutePolicy policy = CamelContextHelper.mandatoryLookup(camelContext, ref, RoutePolicy.class);
                log.debug("RoutePolicy is enabled: {} on route: {}", policy, getId());
                routeContext.getRoutePolicyList().add(policy);
            }
        }
View Full Code Here

Examples of org.apache.camel.spi.RoutePolicy

            return "";
        }

        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < policyList.size(); i++) {
            RoutePolicy policy = policyList.get(i);
            sb.append(policy.getClass().getSimpleName());
            sb.append("(").append(ObjectHelper.getIdentityHashCode(policy)).append(")");
            if (i < policyList.size() - 1) {
                sb.append(", ");
            }
        }
View Full Code Here

Examples of org.apache.camel.spi.RoutePolicy

            return "";
        }

        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < policyList.size(); i++) {
            RoutePolicy policy = policyList.get(i);
            sb.append(policy.getClass().getSimpleName());
            sb.append("(").append(ObjectHelper.getIdentityHashCode(policy)).append(")");
            if (i < policyList.size() - 1) {
                sb.append(", ");
            }
        }
View Full Code Here

Examples of org.apache.camel.spi.RoutePolicy

            return "";
        }

        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < policyList.size(); i++) {
            RoutePolicy policy = policyList.get(i);
            sb.append(policy.getClass().getSimpleName());
            sb.append("(").append(ObjectHelper.getIdentityHashCode(policy)).append(")");
            if (i < policyList.size() - 1) {
                sb.append(", ");
            }
        }
View Full Code Here

Examples of org.apache.camel.spi.RoutePolicy

        }
        if (routePolicyRef != null) {
            StringTokenizer policyTokens = new StringTokenizer(routePolicyRef, ",");
            while (policyTokens.hasMoreTokens()) {
                String ref = policyTokens.nextToken().trim();
                RoutePolicy policy = CamelContextHelper.mandatoryLookup(camelContext, ref, RoutePolicy.class);
                log.debug("RoutePolicy is enabled: {} on route: {}", policy, getId());
                routeContext.getRoutePolicyList().add(policy);
            }
        }
View Full Code Here

Examples of org.apache.camel.spi.RoutePolicy

   
    @SuppressWarnings("unchecked")
    private CamelContext startRouteWithPolicy(String policyBeanName) throws Exception {
        CamelContext context = new DefaultCamelContext();
        ArrayList<RouteDefinition> routes = (ArrayList<RouteDefinition>)applicationContext.getBean("testRouteContext");
        RoutePolicy policy = applicationContext.getBean(policyBeanName, RoutePolicy.class);
        assertTrue(getTestType() == TestType.SIMPLE
            ? policy instanceof SimpleScheduledRoutePolicy
            : policy instanceof CronScheduledRoutePolicy);
        routes.get(0).routePolicy(policy);
        ((ModelCamelContext)context).addRouteDefinitions(routes);
View Full Code Here

Examples of org.apache.camel.spi.RoutePolicy

            UnitOfWorkProcessor unitOfWorkProcessor = new UnitOfWorkProcessor(this, processor);
            Processor target = unitOfWorkProcessor;

            // and then optionally add route policy processor if a custom policy is set
            RoutePolicyProcessor routePolicyProcessor = null;
            RoutePolicy policy = getRoutePolicy();
            if (policy != null) {
                routePolicyProcessor = new RoutePolicyProcessor(unitOfWorkProcessor, policy);
                // add it as service if we have not already done that (eg possible if two routes have the same service)
                if (!camelContext.hasService(policy)) {
                    try {
                        camelContext.addService(policy);
                    } catch (Exception e) {
                        throw ObjectHelper.wrapRuntimeCamelException(e);
                    }
                }
                target = routePolicyProcessor;
            }

            // and wrap it by a instrumentation processor that is to be used for performance stats
            // for this particular route
            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);
            // create the route id
            String routeId = route.idOrCreate(getCamelContext().getNodeIdFactory());
            edcr.getProperties().put(Route.ID_PROPERTY, routeId);
            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);
            }

            // invoke init on route policy
            if (policy != null) {
                policy.onInit(edcr);
            }

            routes.add(edcr);
        }
    }
View Full Code Here

Examples of org.apache.camel.spi.RoutePolicy

            if (log.isDebugEnabled()) {
                log.debug("RoutePolicy is enabled: " + routePolicy + " on route: " + this);
            }
            routeContext.setRoutePolicy(getRoutePolicy());
        } else if (routePolicyRef != null) {
            RoutePolicy policy = CamelContextHelper.mandatoryLookup(camelContext, routePolicyRef, RoutePolicy.class);
            if (log.isDebugEnabled()) {
                log.debug("RoutePolicy is enabled: " + policy + " on route: " + this);
            }
            routeContext.setRoutePolicy(policy);
        }
View Full Code Here

Examples of org.apache.camel.spi.RoutePolicy

        }
        if (routePolicyRef != null) {
            StringTokenizer policyTokens = new StringTokenizer(routePolicyRef, ",");
            while (policyTokens.hasMoreTokens()) {
                String ref = policyTokens.nextToken().trim();
                RoutePolicy policy = CamelContextHelper.mandatoryLookup(camelContext, ref, RoutePolicy.class);
                if (log.isDebugEnabled()) {
                    log.debug("RoutePolicy is enabled: " + policy + " on route: " + getId());
                }
                routeContext.getRoutePolicyList().add(policy);
            }
View Full Code Here

Examples of org.apache.camel.spi.RoutePolicy

   
    @SuppressWarnings("unchecked")
    private CamelContext startRouteWithPolicy(String policyBeanName) throws Exception {
        CamelContext context = new DefaultCamelContext();
        ArrayList<RouteDefinition> routes = (ArrayList<RouteDefinition>)applicationContext.getBean("testRouteContext");
        RoutePolicy policy = (RoutePolicy)applicationContext.getBean(policyBeanName);
        assertTrue(getTestType() == TestType.SIMPLE
            ? policy instanceof SimpleScheduledRoutePolicy
            : policy instanceof CronScheduledRoutePolicy);
        routes.get(0).routePolicy(policy);
        context.addRouteDefinitions(routes);
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.