You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by lleclerc <ll...@aim-rg.com> on 2013/01/29 16:15:09 UTC
Can't do redelivery past 10 seconds
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.
Re: Can't do redelivery past 10 seconds
Posted by Claus Ibsen <cl...@gmail.com>.
The mock endpoint wil by default wait 10 sec before they timeout any may fail.
So if you want longer time you need to tell it, eg to use 2 minutes
assertMockEndpointsSatisfied(2, TimeUnit.MINUTES);
On Wed, Jan 30, 2013 at 3:45 PM, lleclerc <ll...@aim-rg.com> wrote:
> Is it a bug then ?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Can-t-do-redelivery-past-10-seconds-tp5726491p5726563.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
Re: Can't do redelivery past 10 seconds
Posted by lleclerc <ll...@aim-rg.com>.
Is it a bug then ?
--
View this message in context: http://camel.465427.n5.nabble.com/Can-t-do-redelivery-past-10-seconds-tp5726491p5726563.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Can't do redelivery past 10 seconds
Posted by lleclerc <ll...@aim-rg.com>.
Thanks for quick response.
I updated the code in my first post, the tests are still failing :(
--
View this message in context: http://camel.465427.n5.nabble.com/Can-t-do-redelivery-past-10-seconds-tp5726491p5726495.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Can't do redelivery past 10 seconds
Posted by Claus Ibsen <cl...@gmail.com>.
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 <ll...@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