camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Can't do redelivery past 10 seconds
Date Tue, 29 Jan 2013 15:19:10 GMT
Hi

Just override getShutdownTimeout when using CamelTestSupport and
return the timeout value you want in seconds.
Then you dont need to do other stuff

On Tue, Jan 29, 2013 at 4:15 PM, lleclerc <lleclerc@aim-rg.com> wrote:
> Hi,
>
> Using camel 2.11-SNAPSHOT. I don't what wrong I am doing in this test, but
> it won't allow me to
> last more than 12 sec. I want to use allowRedeliveryWhileStopping(false), it
> is not used right now,
> but it might be the source of my problem. Is this a a bug, or I am doing
> something wrong ?
>
> Thanks,
>
>
> Here is the test class :
>
> package abc;
>
> import org.apache.camel.builder.RouteBuilder;
> import org.apache.camel.test.junit4.CamelTestSupport;
> import org.junit.Test;
>
> import java.util.concurrent.TimeUnit;
>
> public class TestRedelivery extends CamelTestSupport {
>
>     private String finalMock = "mock:final";
>
>     /**
>      * This test success
>      */
>     @Test
>     public void testSend3Redelivery() throws Exception {
>         doTestSendRedelivery(3, 1000);
>     }
>
>     /**
>      * This test fails
>      */
>     @Test
>     public void testSend20Redelivery() throws Exception {
>         doTestSendRedelivery(20, 1000);
>     }
>
>     /**
>      * This test success
>      */
>     @Test
>     public void testSend20FastRedelivery() throws Exception {
>         doTestSendRedelivery(20, 100);
>     }
>
>     public void doTestSendRedelivery(final int redelivery, final long
> redeliveryDelay) throws Exception {
>
>         context.addRoutes(new RouteBuilder() {
>             @Override
>             public void configure() throws Exception {
>                 errorHandler(deadLetterChannel(finalMock)
>                         .allowRedeliveryWhileStopping(false)
>
> .maximumRedeliveries(redelivery).redeliveryDelay(redeliveryDelay));
>
>                 from("seda:foo").routeId("foo")
>                         .to("mock:foo")
>                         .throwException(new
> IllegalArgumentException("Forced"));
>             }
>         });
>
>         context.getShutdownStrategy().setTimeUnit(TimeUnit.SECONDS);
>         context.getShutdownStrategy().setTimeout(60);
>
>         context.start();
>
>         getMockEndpoint(finalMock).expectedMessageCount(1);
>
>         template.sendBody("seda:foo", "Hello World");
>
>         assertMockEndpointsSatisfied();
>     }
>
>     @Override
>     public boolean isUseRouteBuilder() {
>         return false;
>     }
> }
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Can-t-do-redelivery-past-10-seconds-tp5726491.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Mime
View raw message