Package org.apache.camel

Examples of org.apache.camel.Channel


        }

        for (Processor child : nav.next()) {

            if (child instanceof Channel) {
                Channel channel = (Channel) child;
                ProcessorDefinition def = channel.getProcessorDefinition();
                navigateDefinition(def, sb);
            }
        }
    }
View Full Code Here


        Processor processor = unwrap(consumerRoute.getProcessor());
        Pipeline pipeline = assertIsInstanceOf(Pipeline.class, processor);

        // there should be a default error handler in front of each processor in this pipeline
        for (Processor child : pipeline.getProcessors()) {
            Channel channel = assertIsInstanceOf(Channel.class, child);
            assertNotNull("There should be an error handler", channel.getErrorHandler());
            assertIsInstanceOf(DefaultErrorHandler.class, channel.getErrorHandler());
        }
    }
View Full Code Here

            boolean endpointInterceptor = false;

            // are we routing to an endpoint interceptor, if so we should not add it as an event driven
            // processor as we use the producer to trigger the interceptor
            if (processor instanceof Channel) {
                Channel channel = (Channel) processor;
                Processor next = channel.getNextProcessor();
                if (next instanceof InterceptEndpointProcessor) {
                    endpointInterceptor = true;
                }
            }
View Full Code Here

        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());
        assertIsInstanceOf(StreamResequencer.class, channel.getNextProcessor());
    }
View Full Code Here

            boolean endpointInterceptor = false;

            // are we routing to an endpoint interceptor, if so we should not add it as an event driven
            // processor as we use the producer to trigger the interceptor
            if (processor instanceof Channel) {
                Channel channel = (Channel) processor;
                Processor next = channel.getNextProcessor();
                if (next instanceof InterceptEndpointProcessor) {
                    endpointInterceptor = true;
                }
            }
View Full Code Here

        return wrapChannel(routeContext, processor, null);
    }

    protected Processor wrapChannel(RouteContext routeContext, Processor processor, ProcessorDefinition child) throws Exception {
        // put a channel in between this and each output to control the route flow logic
        Channel channel = createChannel(routeContext);
        channel.setNextProcessor(processor);

        // add interceptor strategies to the channel must be in this order: camel context, route context, local
        addInterceptStrategies(routeContext, channel, routeContext.getCamelContext().getInterceptStrategies());
        addInterceptStrategies(routeContext, channel, routeContext.getInterceptStrategies());
        if (routeContext.getManagedInterceptStrategy() != null) {
            channel.addInterceptStrategy(routeContext.getManagedInterceptStrategy());
        }
        addInterceptStrategies(routeContext, channel, this.getInterceptStrategies());

        // must do this ugly cast to avoid compiler error on HP-UX
        ProcessorDefinition defn = (ProcessorDefinition) this;

        // set the child before init the channel
        channel.setChildDefinition(child);
        channel.initChannel(defn, routeContext);

        // set the error handler, must be done after init as we can set the error handler as first in the chain
        if (defn instanceof TryDefinition || defn instanceof CatchDefinition || defn instanceof FinallyDefinition) {
            // do not use error handler for try .. catch .. finally blocks as it will handle errors itself
            return channel;
        } else {
            // regular definition so add the error handler
            Processor output = channel.getOutput();
            // create error handler
            ErrorHandlerBuilder builder = getErrorHandlerBuilder();
            Processor errorHandler = builder.createErrorHandler(routeContext, output);
            // set error handler on channel
            channel.setErrorHandler(errorHandler);

            // invoke lifecycles so we can manage this error handler builder
            for (LifecycleStrategy strategy : routeContext.getCamelContext().getLifecycleStrategies()) {
                strategy.onErrorHandlerAdd(routeContext, errorHandler, builder);
            }
View Full Code Here

        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());
        assertIsInstanceOf(StreamResequencer.class, channel.getNextProcessor());
    }
View Full Code Here

        Processor processor = unwrap(consumerRoute.getProcessor());
        Pipeline pipeline = assertIsInstanceOf(Pipeline.class, processor);

        // there should be a default error handler in front of each processor in this pipeline
        for (Processor child : pipeline.getProcessors()) {
            Channel channel = assertIsInstanceOf(Channel.class, child);
            assertNotNull("There should be an error handler", channel.getErrorHandler());
            assertIsInstanceOf(DefaultErrorHandler.class, channel.getErrorHandler());
        }
    }
View Full Code Here

        for (Route route : routes) {
            Endpoint key = route.getEndpoint();
            assertEquals("From endpoint", "direct://a", key.getEndpointUri());

            EventDrivenConsumerRoute consumer = assertIsInstanceOf(EventDrivenConsumerRoute.class, route);
            Channel channel = unwrapChannel(consumer.getProcessor());

            SendProcessor sendProcessor = assertIsInstanceOf(SendProcessor.class, channel.getNextProcessor());
            assertEquals("Endpoint URI", "direct://b", sendProcessor.getDestination().getEndpointUri());
        }
    }
View Full Code Here

        for (Route route : routes) {
            Endpoint key = route.getEndpoint();
            assertEquals("From endpoint", "direct://a", key.getEndpointUri());

            EventDrivenConsumerRoute consumer = assertIsInstanceOf(EventDrivenConsumerRoute.class, route);
            Channel channel = unwrapChannel(consumer.getProcessor());

            FilterProcessor filterProcessor = assertIsInstanceOf(FilterProcessor.class, channel.getNextProcessor());
            SendProcessor sendProcessor = assertIsInstanceOf(SendProcessor.class, unwrapChannel(filterProcessor).getNextProcessor());
            assertEquals("Endpoint URI", "direct://b", sendProcessor.getDestination().getEndpointUri());
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.camel.Channel

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.