[ 
https://issues.apache.org/jira/browse/CAMEL-14442?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Pascal Schumacher updated CAMEL-14442:
--------------------------------------
    Description: 
Using Camel 3.0.1 the scheduler/scheduler-thread is no longer shared between 
routes using the same scheduler name.

Using this test:

{code:java}
public class MultipleRoutesSameSchedulerTest extends CamelTestSupport {

    @Override
    protected RouteBuilder[] createRouteBuilders() throws Exception {
        return new RouteBuilder[] {
            new RouteBuilder() {
                public void configure() {
                    from("scheduler:test?delay=1s").log("test1");
                }
            },
            new RouteBuilder() {
                public void configure() {
                    from("scheduler:test?delay=2s").log("test2");
                }
            },
        };
    }

    @Test
    public void test() throws Exception {
        getMockEndpoint("mock:test").expectedMessageCount(1);

        assertMockEndpointsSatisfied(100, TimeUnit.SECONDS);
    }
}
{code}

Camel 2.23.0 uses the same thread:

{code}
22:05:04.698 [Camel (camel-1) thread #1 - scheduler://test] INFO route1 - test1
22:05:05.697 [Camel (camel-1) thread #1 - scheduler://test] INFO route2 - test2
{code}

Camel 3.0.1 uses two different threads:

{code}
22:03:02.488 [Camel (camel-1) thread #1 - scheduler://test] INFO route1 - test1
22:03:02.308 [Camel (camel-1) thread #2 - scheduler://test] INFO route2 - test2
{code}

Latest documentation claims that only one scheduler thread will be used:

{quote}
scheduler:name[?options]

Where name is the name of the scheduler, which is created and shared across 
endpoints. So if you use the same name for all your scheduler endpoints, only 
one scheduler thread pool and thread will be used...
{quote}

Am I missing something?


  was:
Using Camel 3.0.1 it seems no longer possible to let multiple routes share the 
same scheduler thread anymore.

Using this test:

{code:java}
public class MultipleRoutesSameSchedulerTest extends CamelTestSupport {

    @Override
    protected RouteBuilder[] createRouteBuilders() throws Exception {
        return new RouteBuilder[] {
            new RouteBuilder() {
                public void configure() {
                    from("scheduler:test?delay=1s").log("test1");
                }
            },
            new RouteBuilder() {
                public void configure() {
                    from("scheduler:test?delay=2s").log("test2");
                }
            },
        };
    }

    @Test
    public void test() throws Exception {
        getMockEndpoint("mock:test").expectedMessageCount(1);

        assertMockEndpointsSatisfied(100, TimeUnit.SECONDS);
    }
}
{code}

Camel 2.23.0 uses the same thread:

{code}
22:05:04.698 [Camel (camel-1) thread #1 - scheduler://test] INFO route1 - test1
22:05:05.697 [Camel (camel-1) thread #1 - scheduler://test] INFO route2 - test2
{code}

Camel 3.0.1 uses two different threads:

{code}
22:03:02.488 [Camel (camel-1) thread #1 - scheduler://test] INFO route1 - test1
22:03:02.308 [Camel (camel-1) thread #2 - scheduler://test] INFO route2 - test2
{code}

Latest documentation claims that only one scheduler thread will be used:

{quote}
scheduler:name[?options]

Where name is the name of the scheduler, which is created and shared across 
endpoints. So if you use the same name for all your scheduler endpoints, only 
one scheduler thread pool and thread will be used...
{quote}

Am I missing something?



> Scheduler no longer shared between routes using the same scheduler name
> -----------------------------------------------------------------------
>
>                 Key: CAMEL-14442
>                 URL: https://issues.apache.org/jira/browse/CAMEL-14442
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-scheduler
>    Affects Versions: 3.0.1
>            Reporter: Pascal Schumacher
>            Priority: Major
>
> Using Camel 3.0.1 the scheduler/scheduler-thread is no longer shared between 
> routes using the same scheduler name.
> Using this test:
> {code:java}
> public class MultipleRoutesSameSchedulerTest extends CamelTestSupport {
>     @Override
>     protected RouteBuilder[] createRouteBuilders() throws Exception {
>         return new RouteBuilder[] {
>             new RouteBuilder() {
>                 public void configure() {
>                     from("scheduler:test?delay=1s").log("test1");
>                 }
>             },
>             new RouteBuilder() {
>                 public void configure() {
>                     from("scheduler:test?delay=2s").log("test2");
>                 }
>             },
>         };
>     }
>     @Test
>     public void test() throws Exception {
>         getMockEndpoint("mock:test").expectedMessageCount(1);
>         assertMockEndpointsSatisfied(100, TimeUnit.SECONDS);
>     }
> }
> {code}
> Camel 2.23.0 uses the same thread:
> {code}
> 22:05:04.698 [Camel (camel-1) thread #1 - scheduler://test] INFO route1 - 
> test1
> 22:05:05.697 [Camel (camel-1) thread #1 - scheduler://test] INFO route2 - 
> test2
> {code}
> Camel 3.0.1 uses two different threads:
> {code}
> 22:03:02.488 [Camel (camel-1) thread #1 - scheduler://test] INFO route1 - 
> test1
> 22:03:02.308 [Camel (camel-1) thread #2 - scheduler://test] INFO route2 - 
> test2
> {code}
> Latest documentation claims that only one scheduler thread will be used:
> {quote}
> scheduler:name[?options]
> Where name is the name of the scheduler, which is created and shared across 
> endpoints. So if you use the same name for all your scheduler endpoints, only 
> one scheduler thread pool and thread will be used...
> {quote}
> Am I missing something?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to