Search in sources :

Example 21 with EventDrivenConsumerRoute

use of org.apache.camel.impl.EventDrivenConsumerRoute in project camel by apache.

the class RouteBuilderTest method testSplitter.

public void testSplitter() throws Exception {
    List<Route> routes = buildSplitter();
    log.debug("Created routes: " + routes);
    assertEquals("Number routes created", 1, routes.size());
    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());
        assertIsInstanceOf(Splitter.class, channel.getNextProcessor());
    }
}
Also used : Endpoint(org.apache.camel.Endpoint) Channel(org.apache.camel.Channel) DeadLetterChannel(org.apache.camel.processor.DeadLetterChannel) EventDrivenConsumerRoute(org.apache.camel.impl.EventDrivenConsumerRoute) Route(org.apache.camel.Route) EventDrivenConsumerRoute(org.apache.camel.impl.EventDrivenConsumerRoute)

Example 22 with EventDrivenConsumerRoute

use of org.apache.camel.impl.EventDrivenConsumerRoute 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)

Example 23 with EventDrivenConsumerRoute

use of org.apache.camel.impl.EventDrivenConsumerRoute in project camel by apache.

the class ResequencerTest method testBatchResequencerTypeWithoutJmx.

public void testBatchResequencerTypeWithoutJmx() throws Exception {
    List<Route> list = getRouteList(createRouteBuilder());
    assertEquals("Number of routes created: " + list, 1, list.size());
    Route route = list.get(0);
    EventDrivenConsumerRoute consumerRoute = assertIsInstanceOf(EventDrivenConsumerRoute.class, route);
    DefaultChannel channel = assertIsInstanceOf(DefaultChannel.class, unwrapChannel(consumerRoute.getProcessor()));
    assertIsInstanceOf(DefaultErrorHandler.class, channel.getErrorHandler());
    assertFalse("Should not have stream caching", channel.hasInterceptorStrategy(StreamCaching.class));
    assertIsInstanceOf(Resequencer.class, channel.getNextProcessor());
}
Also used : DefaultChannel(org.apache.camel.processor.interceptor.DefaultChannel) StreamCaching(org.apache.camel.processor.interceptor.StreamCaching) EventDrivenConsumerRoute(org.apache.camel.impl.EventDrivenConsumerRoute) Route(org.apache.camel.Route) EventDrivenConsumerRoute(org.apache.camel.impl.EventDrivenConsumerRoute)

Aggregations

EventDrivenConsumerRoute (org.apache.camel.impl.EventDrivenConsumerRoute)23 Route (org.apache.camel.Route)21 Channel (org.apache.camel.Channel)17 Endpoint (org.apache.camel.Endpoint)15 DeadLetterChannel (org.apache.camel.processor.DeadLetterChannel)15 Processor (org.apache.camel.Processor)13 SendProcessor (org.apache.camel.processor.SendProcessor)12 FilterProcessor (org.apache.camel.processor.FilterProcessor)8 DelegateProcessor (org.apache.camel.DelegateProcessor)6 ChoiceProcessor (org.apache.camel.processor.ChoiceProcessor)5 EvaluateExpressionProcessor (org.apache.camel.processor.EvaluateExpressionProcessor)5 MulticastProcessor (org.apache.camel.processor.MulticastProcessor)5 ThreadsProcessor (org.apache.camel.processor.ThreadsProcessor)5 Pipeline (org.apache.camel.processor.Pipeline)3 RedeliveryPolicy (org.apache.camel.processor.RedeliveryPolicy)3 ArrayList (java.util.ArrayList)2 SpringCamelContext (org.apache.camel.spring.SpringCamelContext)2 JMException (javax.management.JMException)1 MalformedObjectNameException (javax.management.MalformedObjectNameException)1 CamelContext (org.apache.camel.CamelContext)1