Search in sources :

Example 21 with Channel

use of org.apache.camel.Channel in project camel by apache.

the class ContextErrorHandlerTest method testOverloadingTheDefaultErrorHandler.

public void testOverloadingTheDefaultErrorHandler() throws Exception {
    RouteBuilder builder = new RouteBuilder() {

        public void configure() {
            errorHandler(loggingErrorHandler("FOO.BAR"));
            from("seda:a").to("seda:b");
        }
    };
    List<Route> list = getRouteListWithCurrentContext(builder);
    assertEquals("Number routes created" + list, 1, list.size());
    for (Route route : list) {
        Endpoint key = route.getEndpoint();
        assertEquals("From endpoint", "seda://a", key.getEndpointUri());
        EventDrivenConsumerRoute consumerRoute = assertIsInstanceOf(EventDrivenConsumerRoute.class, route);
        Processor processor = consumerRoute.getProcessor();
        Channel channel = unwrapChannel(processor);
        assertIsInstanceOf(LoggingErrorHandler.class, channel.getErrorHandler());
        SendProcessor sendProcessor = assertIsInstanceOf(SendProcessor.class, channel.getNextProcessor());
        log.debug("Found sendProcessor: " + sendProcessor);
    }
}
Also used : Processor(org.apache.camel.Processor) SendProcessor(org.apache.camel.processor.SendProcessor) Endpoint(org.apache.camel.Endpoint) Channel(org.apache.camel.Channel) DeadLetterChannel(org.apache.camel.processor.DeadLetterChannel) EventDrivenConsumerRoute(org.apache.camel.impl.EventDrivenConsumerRoute) SendProcessor(org.apache.camel.processor.SendProcessor) Route(org.apache.camel.Route) EventDrivenConsumerRoute(org.apache.camel.impl.EventDrivenConsumerRoute)

Aggregations

Channel (org.apache.camel.Channel)21 Route (org.apache.camel.Route)17 EventDrivenConsumerRoute (org.apache.camel.impl.EventDrivenConsumerRoute)17 DeadLetterChannel (org.apache.camel.processor.DeadLetterChannel)15 Endpoint (org.apache.camel.Endpoint)13 Processor (org.apache.camel.Processor)12 SendProcessor (org.apache.camel.processor.SendProcessor)10 FilterProcessor (org.apache.camel.processor.FilterProcessor)6 ArrayList (java.util.ArrayList)3 DelegateProcessor (org.apache.camel.DelegateProcessor)3 ChoiceProcessor (org.apache.camel.processor.ChoiceProcessor)3 EvaluateExpressionProcessor (org.apache.camel.processor.EvaluateExpressionProcessor)3 MulticastProcessor (org.apache.camel.processor.MulticastProcessor)3 RedeliveryPolicy (org.apache.camel.processor.RedeliveryPolicy)3 ThreadsProcessor (org.apache.camel.processor.ThreadsProcessor)3 Pipeline (org.apache.camel.processor.Pipeline)2 Consumer (org.apache.camel.Consumer)1 NonManagedService (org.apache.camel.NonManagedService)1 Producer (org.apache.camel.Producer)1 Service (org.apache.camel.Service)1