Search in sources :

Example 11 with FailedToStartRouteException

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

the class RouteStartupOrderClashTest method testRouteStartupOrderClash.

public void testRouteStartupOrderClash() throws Exception {
    context.addRoutes(new RouteBuilder() {

        @Override
        public void configure() throws Exception {
            from("seda:foo").startupOrder(2).to("mock:result");
            from("direct:start").startupOrder(1).to("seda:foo");
            // clash as we got two routes with order 2
            from("seda:bar").startupOrder(2).to("mock:bar");
        }
    });
    try {
        context.start();
        fail("Should have thrown an exception");
    } catch (FailedToStartRouteException e) {
        // expected
        assertTrue(e.getMessage().contains("startupOrder 2"));
    }
}
Also used : FailedToStartRouteException(org.apache.camel.FailedToStartRouteException) RouteBuilder(org.apache.camel.builder.RouteBuilder) FailedToStartRouteException(org.apache.camel.FailedToStartRouteException)

Example 12 with FailedToStartRouteException

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

the class DisruptorConcurrentConsumersNPEIssueTest method testStartThird.

@Test
public void testStartThird() throws Exception {
    final MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedBodiesReceived("Hello World");
    template.sendBody("disruptor:foo", "Hello World");
    assertMockEndpointsSatisfied();
    // this should be okay
    context.startRoute("third");
    try {
        context.startRoute("first");
        fail("Should have thrown exception");
    } catch (FailedToStartRouteException e) {
        assertEquals("Failed to start route first because of Multiple consumers for the same endpoint is not allowed:" + " disruptor://foo?concurrentConsumers=5", e.getMessage());
    }
}
Also used : FailedToStartRouteException(org.apache.camel.FailedToStartRouteException) MockEndpoint(org.apache.camel.component.mock.MockEndpoint) Test(org.junit.Test)

Aggregations

FailedToStartRouteException (org.apache.camel.FailedToStartRouteException)12 RouteBuilder (org.apache.camel.builder.RouteBuilder)7 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)4 Test (org.junit.Test)3 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 CamelContext (org.apache.camel.CamelContext)1 Consumer (org.apache.camel.Consumer)1 Endpoint (org.apache.camel.Endpoint)1 PollingConsumer (org.apache.camel.PollingConsumer)1 Route (org.apache.camel.Route)1 ServiceStatus (org.apache.camel.ServiceStatus)1 ShutdownRoute (org.apache.camel.ShutdownRoute)1 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)1