Examples of InterceptStrategy


Examples of org.apache.camel.spi.InterceptStrategy

        // create the output processor
        // TODO: This should be mandatory (but ExceptionHandlerStreamCacheTest fails)
        output = this.createChildProcessor(routeContext, false);

        // add the output as a intercept strategy to the route context so its invoked on each processing step
        routeContext.getInterceptStrategies().add(new InterceptStrategy() {
            private Processor interceptedTarget;

            public Processor wrapProcessorInInterceptors(CamelContext context, ProcessorDefinition definition,
                                                         Processor target, Processor nextTarget) throws Exception {
                // prefer next target over target as next target is the real target
View Full Code Here

Examples of org.apache.camel.spi.InterceptStrategy

        Processor target = nextProcessor;
        Processor next;

        // first wrap the output with the managed strategy if any
        InterceptStrategy managed = routeContext.getManagedInterceptStrategy();
        if (managed != null) {
            next = target == nextProcessor ? null : nextProcessor;
            target = managed.wrapProcessorInInterceptors(routeContext.getCamelContext(), outputDefinition, target, next);
        }

        // then wrap the output with the tracer
        // the tracer should have the fine grained definition so if a child is set then use it, if not then its the original output used
        ProcessorDefinition<?> traceDef = childDefinition != null ? childDefinition : outputDefinition;
View Full Code Here

Examples of org.apache.camel.spi.InterceptStrategy

        // sets the delegate to our wrapped output
        output = target;
    }

    private InterceptStrategy getOrCreateTracer() {
        InterceptStrategy tracer = Tracer.getTracer(camelContext);
        if (tracer == null) {
            if (camelContext.getRegistry() != null) {
                // lookup in registry
                Map<String, Tracer> map = camelContext.getRegistry().lookupByType(Tracer.class);
                if (map.size() == 1) {
View Full Code Here

Examples of org.apache.camel.spi.InterceptStrategy

        // add global interceptors
        Map<String, InterceptStrategy> interceptStrategies = getContext().getRegistry().lookupByType(InterceptStrategy.class);
        if (interceptStrategies != null && !interceptStrategies.isEmpty()) {
            for (String id : interceptStrategies.keySet()) {
                InterceptStrategy strategy = interceptStrategies.get(id);
                // do not add if already added, for instance a tracer that is also an InterceptStrategy class
                if (!getContext().getInterceptStrategies().contains(strategy)) {
                    LOG.info("Using custom InterceptStrategy with id: " + id + " and implementation: " + strategy);
                    getContext().addInterceptStrategy(strategy);
                }
View Full Code Here

Examples of org.apache.camel.spi.InterceptStrategy

        }
        // add global interceptors
        Map<String, InterceptStrategy> interceptStrategies = getContext().getRegistry().lookupByType(InterceptStrategy.class);
        if (interceptStrategies != null && !interceptStrategies.isEmpty()) {
            for (Entry<String, InterceptStrategy> entry : interceptStrategies.entrySet()) {
                InterceptStrategy strategy = entry.getValue();
                // do not add if already added, for instance a tracer that is also an InterceptStrategy class
                if (!getContext().getInterceptStrategies().contains(strategy)) {
                    LOG.info("Using custom InterceptStrategy with id: " + entry.getKey() + " and implementation: " + strategy);
                    getContext().addInterceptStrategy(strategy);
                }
View Full Code Here

Examples of org.apache.camel.spi.InterceptStrategy

                    continue;
                } else {
                    // replace existing delayer as delayer have individual configuration
                    Iterator<InterceptStrategy> it = channel.getInterceptStrategies().iterator();
                    while (it.hasNext()) {
                        InterceptStrategy existing = it.next();
                        if (existing instanceof Delayer) {
                            it.remove();
                        }
                    }
                    // add the new correct delayer
View Full Code Here

Examples of org.apache.camel.spi.InterceptStrategy

        if (childDefinition != null && outputDefinition != childDefinition) {
            childDefinition.setParent(outputDefinition);
        }

        // first wrap the output with the managed strategy if any
        InterceptStrategy managed = routeContext.getManagedInterceptStrategy();
        if (managed != null) {
            next = target == nextProcessor ? null : nextProcessor;
            target = managed.wrapProcessorInInterceptors(routeContext.getCamelContext(), targetOutputDef, target, next);
        }

        // then wrap the output with the tracer
        TraceInterceptor trace = (TraceInterceptor) getOrCreateTracer().wrapProcessorInInterceptors(routeContext.getCamelContext(), targetOutputDef, target, null);
        // trace interceptor need to have a reference to route context so we at runtime can enable/disable tracing on-the-fly
View Full Code Here

Examples of org.apache.camel.spi.InterceptStrategy

            }
        }
    }

    private InterceptStrategy getOrCreateTracer() {
        InterceptStrategy tracer = Tracer.getTracer(camelContext);
        if (tracer == null) {
            if (camelContext.getRegistry() != null) {
                // lookup in registry
                Map<String, Tracer> map = camelContext.getRegistry().lookupByType(Tracer.class);
                if (map.size() == 1) {
View Full Code Here

Examples of org.apache.camel.spi.InterceptStrategy

        // add global interceptors
        Map<String, InterceptStrategy> strategies = getContext().getRegistry().lookupByType(InterceptStrategy.class);
        if (strategies != null && !strategies.isEmpty()) {
            for (String id : strategies.keySet()) {
                InterceptStrategy strategy = strategies.get(id);
                // do not add if already added, for instance a tracer that is also an InterceptStrategy class
                if (!getContext().getInterceptStrategies().contains(strategy)) {
                    LOG.info("Using custom intercept strategy with id: " + id + " and implementation: " + strategy);
                    getContext().addInterceptStrategy(strategy);
                }
View Full Code Here

Examples of org.apache.camel.spi.InterceptStrategy

        // only needed to register on the first output as all rotues will pass through this one
        ProcessorDefinition out = routeContext.getRoute().getOutputs().get(0);

        // add an intercept strategy that counts when the route sends to any of its outputs
        out.addInterceptStrategy(new InterceptStrategy() {
            public Processor wrapProcessorInInterceptors(ProcessorDefinition processorDefinition, Processor target, Processor nextTarget) throws Exception {
                if (registeredRoutes.containsKey(endpoint)) {
                    // do not double wrap
                    return target;
                }
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.