camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John <John.Fans...@ateb.com>
Subject errorHandler when stopping routes in test
Date Mon, 10 Jan 2011 15:54:49 GMT

Hi,

I'm running 2.6-SNAPSHOT.

I have a route builder that sets up a number of routes. One of the routes is
a timer route.

For my unit tests, I would like to stop the timer route so that it doesn't
fire. Unfortunately when I stop the timer route, it appears to impact the
overall error handler.

An example of my route builder is:

            public void configure() throws Exception {
                errorHandler(deadLetterChannel("direct:emailSupport")
                    .maximumRedeliveries(2)
                    .redeliveryDelay(0));

                from("direct:emailSupport")
                    .routeId("smtpRoute")
                    .errorHandler(deadLetterChannel("log:dead?level=ERROR"))
                    .to("smtp://smtpServer");

               
from("timer://someTimer?delay=15000&fixedRate=true&period=5000")
                    .routeId("pollRoute")
                    .to("log:level=INFO");

                from("direct:start")
                    .routeId("TestRoute")
                    .to("seda:foo");
            }
        };

I am attempting to test the "TestRoute" and the error handler. In the test
itself, I intercept and throw an exception on the seda end point. I also
intercept the smtp endpoint with a mock. 

I expect the exceptions thrown on the seda endpoint to go through the error
handler and eventually hit the smtp endpoint when the retries are exhausted.

If I stop the "pollRoute" before running my test, I get an error:
    java.lang.IllegalStateException: SendProcessor has not been started:
sendTo(Endpoint[direct://emailSupport] InOnly)

Everything works as expected if I leave the timer route running.

If you have any ideas on what may be going on here, I'd appreciate it!

Thanks,

-john
-- 
View this message in context: http://camel.465427.n5.nabble.com/errorHandler-when-stopping-routes-in-test-tp3335015p3335015.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message