camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Minh Tran (JIRA)" <>
Subject [jira] [Commented] (CAMEL-10616) shutdown timeout override not working in unit tests
Date Mon, 19 Dec 2016 22:48:58 GMT


Minh Tran commented on CAMEL-10616:

You need a unit test that runs the route in its own thread so that your unit test will end
and camel will shutdown the context. The following exhibits the problem. You can set a breakpoint
in org.apache.camel.processor.exceptionpolicy.DefaultExceptionPolicyStrategy.findMatchedExceptionPolicy()
(this was what I was debugging) and wait for longer than 10sec.

public class MyTest {
	public static class Config extends SpringRouteBuilder {

		public void configure() throws Exception {
                             .throwException(RuntimeException.class, "something bad happened");

		public ShutdownStrategy shutdownStrategy() {
			DefaultShutdownStrategy strat = new DefaultShutdownStrategy();
			// this is ignored
			return strat;


	@Produce(uri = "activemq:queue:a")
	private ProducerTemplate producer;

	public void testHello() throws InterruptedException {

If we can just override the shutdown timeout in unit tests, this wouldn't be an issue. Looks
like it might be fixed in 2.18.2 according to linked issue CAMEL-10619?

> shutdown timeout override not working in unit tests
> ---------------------------------------------------
>                 Key: CAMEL-10616
>                 URL:
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-spring-boot
>    Affects Versions: 2.18.1
>            Reporter: Minh Tran
>            Priority: Minor
> In my main application, I can override the timeout by declaring my own ShutdownStrategy
bean and setting the timeout property. However this seems to be ignored during unit tests
and always uses 10s timeouts.
> The bean is certainly being picked up because I see the following logging
> {noformat}
> org.apache.camel.spring.boot.CamelAutoConfiguration - Using custom ShutdownStrategy:
> {noformat}
> This is preventing me from doing any debugging during unit tests as it will always end
the jvm before I can inspect anything.

This message was sent by Atlassian JIRA

View raw message