Search in sources :

Example 6 with MulticastProcessor

use of org.apache.camel.processor.MulticastProcessor in project camel by apache.

the class RouteBuilderTest method testWireTap.

public void testWireTap() throws Exception {
    List<Route> routes = buildWireTap();
    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());
        MulticastProcessor multicastProcessor = assertIsInstanceOf(MulticastProcessor.class, channel.getNextProcessor());
        List<Processor> endpoints = new ArrayList<Processor>(multicastProcessor.getProcessors());
        assertEquals("Should have 2 endpoints", 2, endpoints.size());
        assertSendToProcessor(unwrapChannel(endpoints.get(0)).getNextProcessor(), "direct://tap");
        assertSendToProcessor(unwrapChannel(endpoints.get(1)).getNextProcessor(), "direct://b");
    }
}
Also used : DelegateProcessor(org.apache.camel.DelegateProcessor) Processor(org.apache.camel.Processor) MulticastProcessor(org.apache.camel.processor.MulticastProcessor) FilterProcessor(org.apache.camel.processor.FilterProcessor) EvaluateExpressionProcessor(org.apache.camel.processor.EvaluateExpressionProcessor) ThreadsProcessor(org.apache.camel.processor.ThreadsProcessor) SendProcessor(org.apache.camel.processor.SendProcessor) ChoiceProcessor(org.apache.camel.processor.ChoiceProcessor) Endpoint(org.apache.camel.Endpoint) Channel(org.apache.camel.Channel) DeadLetterChannel(org.apache.camel.processor.DeadLetterChannel) ArrayList(java.util.ArrayList) MulticastProcessor(org.apache.camel.processor.MulticastProcessor) EventDrivenConsumerRoute(org.apache.camel.impl.EventDrivenConsumerRoute) Route(org.apache.camel.Route) EventDrivenConsumerRoute(org.apache.camel.impl.EventDrivenConsumerRoute)

Aggregations

MulticastProcessor (org.apache.camel.processor.MulticastProcessor)6 Processor (org.apache.camel.Processor)5 ArrayList (java.util.ArrayList)3 DelegateProcessor (org.apache.camel.DelegateProcessor)2 Endpoint (org.apache.camel.Endpoint)2 Iterator (java.util.Iterator)1 ExecutorService (java.util.concurrent.ExecutorService)1 AsyncCallback (org.apache.camel.AsyncCallback)1 AsyncEndpoint (org.apache.camel.AsyncEndpoint)1 Channel (org.apache.camel.Channel)1 Route (org.apache.camel.Route)1 BeanProcessor (org.apache.camel.component.bean.BeanProcessor)1 LogEndpoint (org.apache.camel.component.log.LogEndpoint)1 DefaultEndpoint (org.apache.camel.impl.DefaultEndpoint)1 EventDrivenConsumerRoute (org.apache.camel.impl.EventDrivenConsumerRoute)1 ManagedAggregateProcessor (org.apache.camel.management.mbean.ManagedAggregateProcessor)1 ManagedBeanProcessor (org.apache.camel.management.mbean.ManagedBeanProcessor)1 ManagedChoice (org.apache.camel.management.mbean.ManagedChoice)1 ManagedCircuitBreakerLoadBalancer (org.apache.camel.management.mbean.ManagedCircuitBreakerLoadBalancer)1 ManagedConvertBody (org.apache.camel.management.mbean.ManagedConvertBody)1