You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Willem Jiang (Created) (JIRA)" <ji...@apache.org> on 2011/12/17 09:05:30 UTC

[jira] [Created] (CAMEL-4790) Using the CamelContext.stopRoute(routeId) should not remove the route from context

Using the CamelContext.stopRoute(routeId) should not remove the route from context
----------------------------------------------------------------------------------

                 Key: CAMEL-4790
                 URL: https://issues.apache.org/jira/browse/CAMEL-4790
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 2.8.3
            Reporter: Willem Jiang
            Assignee: Willem Jiang
             Fix For: 2.9.0


Christian reported a camel route stop issue few months ago[1], I found this bug by running the unit test he submit.
{code}
public class RouteRemoveTest extends ContextTestSupport {
 
+    public void testStopRouteOnContext() throws Exception {
+        assertEquals(ServiceStatus.Started, ((DefaultRoute) context.getRoute("foo")).getStatus());
+        assertEquals(ServiceStatus.Started, context.getRouteStatus("foo"));
+        
+        context.stopRoute("foo");
+        
+        assertEquals(ServiceStatus.Stopped, ((DefaultRoute) context.getRoute("foo")).getStatus());
+        assertEquals(ServiceStatus.Stopped, context.getRouteStatus("foo"));
+    }
{code}

The route foo should not be removed from the camelContext.
[1] http://camel.465427.n5.nabble.com/Stop-a-route-for-unit-testing-tt4724550.html#a5011082



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Reopened] (CAMEL-4790) Using the CamelContext.stopRoute(routeId) should not remove the route from context

Posted by "Christian Müller (Reopened JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4790?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christian Müller reopened CAMEL-4790:
-------------------------------------


I added the second unit test I provided and it still fails:

{code:java}
public void testStopRouteOnRoute() throws Exception {
    assertEquals(ServiceStatus.Started, ((DefaultRoute) context.getRoute("foo")).getStatus());
    assertEquals(ServiceStatus.Started, context.getRouteStatus("foo"));

    ((DefaultRoute) context.getRoute("foo")).stop();

    assertEquals(ServiceStatus.Stopped, ((DefaultRoute) context.getRoute("foo")).getStatus());
    assertEquals(ServiceStatus.Stopped, context.getRouteStatus("foo"));
}
{code}

Do I something stupid?
                
> Using the CamelContext.stopRoute(routeId) should not remove the route from context
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-4790
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4790
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.8.3
>            Reporter: Willem Jiang
>            Assignee: Willem Jiang
>             Fix For: 2.8.4, 2.9.0
>
>
> Christian reported a camel route stop issue few months ago[1], I found this bug by running the unit test he submit.
> {code}
> public class RouteRemoveTest extends ContextTestSupport {
>  
> +    public void testStopRouteOnContext() throws Exception {
> +        assertEquals(ServiceStatus.Started, ((DefaultRoute) context.getRoute("foo")).getStatus());
> +        assertEquals(ServiceStatus.Started, context.getRouteStatus("foo"));
> +        
> +        context.stopRoute("foo");
> +        
> +        assertEquals(ServiceStatus.Stopped, ((DefaultRoute) context.getRoute("foo")).getStatus());
> +        assertEquals(ServiceStatus.Stopped, context.getRouteStatus("foo"));
> +    }
> {code}
> The route foo should not be removed from the camelContext.
> [1] http://camel.465427.n5.nabble.com/Stop-a-route-for-unit-testing-tt4724550.html#a5011082

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (CAMEL-4790) Using the CamelContext.stopRoute(routeId) should not remove the route from context

Posted by "Willem Jiang (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4790?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13171581#comment-13171581 ] 

Willem Jiang commented on CAMEL-4790:
-------------------------------------

@Claus,
I just committed the backport fix of Camel 2.8.x after resolving some network connect issue.
                
> Using the CamelContext.stopRoute(routeId) should not remove the route from context
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-4790
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4790
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.8.3
>            Reporter: Willem Jiang
>            Assignee: Willem Jiang
>             Fix For: 2.8.4, 2.9.0
>
>
> Christian reported a camel route stop issue few months ago[1], I found this bug by running the unit test he submit.
> {code}
> public class RouteRemoveTest extends ContextTestSupport {
>  
> +    public void testStopRouteOnContext() throws Exception {
> +        assertEquals(ServiceStatus.Started, ((DefaultRoute) context.getRoute("foo")).getStatus());
> +        assertEquals(ServiceStatus.Started, context.getRouteStatus("foo"));
> +        
> +        context.stopRoute("foo");
> +        
> +        assertEquals(ServiceStatus.Stopped, ((DefaultRoute) context.getRoute("foo")).getStatus());
> +        assertEquals(ServiceStatus.Stopped, context.getRouteStatus("foo"));
> +    }
> {code}
> The route foo should not be removed from the camelContext.
> [1] http://camel.465427.n5.nabble.com/Stop-a-route-for-unit-testing-tt4724550.html#a5011082

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4790) Using the CamelContext.stopRoute(routeId) should not remove the route from context

Posted by "Willem Jiang (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4790?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13171718#comment-13171718 ] 

Willem Jiang commented on CAMEL-4790:
-------------------------------------

Hi Christian

I was planing to send a mail for the second unit test but it takes me too much time to merge the patch due to the network issue.

Here is my explanation for it, because Camel is using the RouteService to delegate the life cycle invocation, it is also in charge of do some clean up work with the CamelContext. If you just stop the route directly without through the CamelContext API, you will face a issue that the RouteService can not has the same status of the Route.
So my suggestion is you should use the CamelContext API instead of stop the route directly.

We should consider not expose the Route itself to client to use in Camel 3.0.
  

                
> Using the CamelContext.stopRoute(routeId) should not remove the route from context
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-4790
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4790
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.8.3
>            Reporter: Willem Jiang
>            Assignee: Willem Jiang
>             Fix For: 2.8.4, 2.9.0
>
>
> Christian reported a camel route stop issue few months ago[1], I found this bug by running the unit test he submit.
> {code}
> public class RouteRemoveTest extends ContextTestSupport {
>  
> +    public void testStopRouteOnContext() throws Exception {
> +        assertEquals(ServiceStatus.Started, ((DefaultRoute) context.getRoute("foo")).getStatus());
> +        assertEquals(ServiceStatus.Started, context.getRouteStatus("foo"));
> +        
> +        context.stopRoute("foo");
> +        
> +        assertEquals(ServiceStatus.Stopped, ((DefaultRoute) context.getRoute("foo")).getStatus());
> +        assertEquals(ServiceStatus.Stopped, context.getRouteStatus("foo"));
> +    }
> {code}
> The route foo should not be removed from the camelContext.
> [1] http://camel.465427.n5.nabble.com/Stop-a-route-for-unit-testing-tt4724550.html#a5011082

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (CAMEL-4790) Using the CamelContext.stopRoute(routeId) should not remove the route from context

Posted by "Claus Ibsen (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4790?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-4790.
--------------------------------

    Resolution: Fixed

No we should not deprecate those methods, as end users should be able to get the Route instance if they need.

Its just the lifecycle of the routes is best handled using the API from CamelContext to ensure graceful shutdown, and whatnot.
                
> Using the CamelContext.stopRoute(routeId) should not remove the route from context
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-4790
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4790
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.8.3
>            Reporter: Willem Jiang
>            Assignee: Willem Jiang
>             Fix For: 2.8.4, 2.9.0
>
>
> Christian reported a camel route stop issue few months ago[1], I found this bug by running the unit test he submit.
> {code}
> public class RouteRemoveTest extends ContextTestSupport {
>  
> +    public void testStopRouteOnContext() throws Exception {
> +        assertEquals(ServiceStatus.Started, ((DefaultRoute) context.getRoute("foo")).getStatus());
> +        assertEquals(ServiceStatus.Started, context.getRouteStatus("foo"));
> +        
> +        context.stopRoute("foo");
> +        
> +        assertEquals(ServiceStatus.Stopped, ((DefaultRoute) context.getRoute("foo")).getStatus());
> +        assertEquals(ServiceStatus.Stopped, context.getRouteStatus("foo"));
> +    }
> {code}
> The route foo should not be removed from the camelContext.
> [1] http://camel.465427.n5.nabble.com/Stop-a-route-for-unit-testing-tt4724550.html#a5011082

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4790) Using the CamelContext.stopRoute(routeId) should not remove the route from context

Posted by "Claus Ibsen (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4790?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13171578#comment-13171578 ] 

Claus Ibsen commented on CAMEL-4790:
------------------------------------

Willem is this an issue in Camel 2.8.x as well? If so please backport the fix.
                
> Using the CamelContext.stopRoute(routeId) should not remove the route from context
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-4790
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4790
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.8.3
>            Reporter: Willem Jiang
>            Assignee: Willem Jiang
>             Fix For: 2.9.0
>
>
> Christian reported a camel route stop issue few months ago[1], I found this bug by running the unit test he submit.
> {code}
> public class RouteRemoveTest extends ContextTestSupport {
>  
> +    public void testStopRouteOnContext() throws Exception {
> +        assertEquals(ServiceStatus.Started, ((DefaultRoute) context.getRoute("foo")).getStatus());
> +        assertEquals(ServiceStatus.Started, context.getRouteStatus("foo"));
> +        
> +        context.stopRoute("foo");
> +        
> +        assertEquals(ServiceStatus.Stopped, ((DefaultRoute) context.getRoute("foo")).getStatus());
> +        assertEquals(ServiceStatus.Stopped, context.getRouteStatus("foo"));
> +    }
> {code}
> The route foo should not be removed from the camelContext.
> [1] http://camel.465427.n5.nabble.com/Stop-a-route-for-unit-testing-tt4724550.html#a5011082

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4790) Using the CamelContext.stopRoute(routeId) should not remove the route from context

Posted by "Christian Müller (Commented JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4790?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13171848#comment-13171848 ] 

Christian Müller commented on CAMEL-4790:
-----------------------------------------

Should we deprecate the methods (context.getRoute(String), context.getRoutes(), ...)?
                
> Using the CamelContext.stopRoute(routeId) should not remove the route from context
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-4790
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4790
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.8.3
>            Reporter: Willem Jiang
>            Assignee: Willem Jiang
>             Fix For: 2.8.4, 2.9.0
>
>
> Christian reported a camel route stop issue few months ago[1], I found this bug by running the unit test he submit.
> {code}
> public class RouteRemoveTest extends ContextTestSupport {
>  
> +    public void testStopRouteOnContext() throws Exception {
> +        assertEquals(ServiceStatus.Started, ((DefaultRoute) context.getRoute("foo")).getStatus());
> +        assertEquals(ServiceStatus.Started, context.getRouteStatus("foo"));
> +        
> +        context.stopRoute("foo");
> +        
> +        assertEquals(ServiceStatus.Stopped, ((DefaultRoute) context.getRoute("foo")).getStatus());
> +        assertEquals(ServiceStatus.Stopped, context.getRouteStatus("foo"));
> +    }
> {code}
> The route foo should not be removed from the camelContext.
> [1] http://camel.465427.n5.nabble.com/Stop-a-route-for-unit-testing-tt4724550.html#a5011082

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Resolved] (CAMEL-4790) Using the CamelContext.stopRoute(routeId) should not remove the route from context

Posted by "Willem Jiang (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4790?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Willem Jiang resolved CAMEL-4790.
---------------------------------

       Resolution: Fixed
    Fix Version/s: 2.8.4

committed the patch into trunk and 2.8.x branch.
                
> Using the CamelContext.stopRoute(routeId) should not remove the route from context
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-4790
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4790
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.8.3
>            Reporter: Willem Jiang
>            Assignee: Willem Jiang
>             Fix For: 2.8.4, 2.9.0
>
>
> Christian reported a camel route stop issue few months ago[1], I found this bug by running the unit test he submit.
> {code}
> public class RouteRemoveTest extends ContextTestSupport {
>  
> +    public void testStopRouteOnContext() throws Exception {
> +        assertEquals(ServiceStatus.Started, ((DefaultRoute) context.getRoute("foo")).getStatus());
> +        assertEquals(ServiceStatus.Started, context.getRouteStatus("foo"));
> +        
> +        context.stopRoute("foo");
> +        
> +        assertEquals(ServiceStatus.Stopped, ((DefaultRoute) context.getRoute("foo")).getStatus());
> +        assertEquals(ServiceStatus.Stopped, context.getRouteStatus("foo"));
> +    }
> {code}
> The route foo should not be removed from the camelContext.
> [1] http://camel.465427.n5.nabble.com/Stop-a-route-for-unit-testing-tt4724550.html#a5011082

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4790) Using the CamelContext.stopRoute(routeId) should not remove the route from context

Posted by "Claus Ibsen (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4790?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13171789#comment-13171789 ] 

Claus Ibsen commented on CAMEL-4790:
------------------------------------

I have added javadoc notes to the API to document how to properly control the lifecycle of the routes, eg use the API from CamelContext.
                
> Using the CamelContext.stopRoute(routeId) should not remove the route from context
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-4790
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4790
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.8.3
>            Reporter: Willem Jiang
>            Assignee: Willem Jiang
>             Fix For: 2.8.4, 2.9.0
>
>
> Christian reported a camel route stop issue few months ago[1], I found this bug by running the unit test he submit.
> {code}
> public class RouteRemoveTest extends ContextTestSupport {
>  
> +    public void testStopRouteOnContext() throws Exception {
> +        assertEquals(ServiceStatus.Started, ((DefaultRoute) context.getRoute("foo")).getStatus());
> +        assertEquals(ServiceStatus.Started, context.getRouteStatus("foo"));
> +        
> +        context.stopRoute("foo");
> +        
> +        assertEquals(ServiceStatus.Stopped, ((DefaultRoute) context.getRoute("foo")).getStatus());
> +        assertEquals(ServiceStatus.Stopped, context.getRouteStatus("foo"));
> +    }
> {code}
> The route foo should not be removed from the camelContext.
> [1] http://camel.465427.n5.nabble.com/Stop-a-route-for-unit-testing-tt4724550.html#a5011082

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira