Package org.apache.camel.spi

Examples of org.apache.camel.spi.RoutePolicy


   
    @SuppressWarnings("unchecked")
    private CamelContext startRouteWithPolicy(String policyBeanName) throws Exception {
        CamelContext context = new DefaultCamelContext();
        List<RouteDefinition> routes = (List<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


   
    @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);
        ((ModelCamelContext)context).addRouteDefinitions(routes);
View Full Code Here

            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

        route.getRouteContext().setTracing(tracing);
    }

    @ManagedAttribute(description = "Route Policy")
    public String getRoutePolicy() {
        RoutePolicy policy = route.getRouteContext().getRoutePolicy();
        if (policy != null) {
            StringBuilder sb = new StringBuilder();
            sb.append(policy.getClass().getSimpleName());
            sb.append("(").append(ObjectHelper.getIdentityHashCode(policy)).append(")");
            return sb.toString();
        }
        return null;
    }
View Full Code Here

        }
        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

        }
        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

            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

    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                // create the flip route policy
                RoutePolicy policy = new FlipRoutePolicy("foo", "bar");

                // use the flip route policy in the foo route
                from("timer://foo")
                    .routeId("foo").routePolicy(policy)
                    .setBody().constant("Foo message")
View Full Code Here

            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

            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

TOP

Related Classes of org.apache.camel.spi.RoutePolicy

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.