You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2010/08/06 07:42:47 UTC

[jira] Created: (CAMEL-3031) Auto assigned CamelContext id should be unique in the JVM

Auto assigned CamelContext id should be unique in the JVM
---------------------------------------------------------

                 Key: CAMEL-3031
                 URL: https://issues.apache.org/activemq/browse/CAMEL-3031
             Project: Apache Camel
          Issue Type: Bug
          Components: camel-core
            Reporter: Claus Ibsen
             Fix For: 2.5.0


See nabble
http://camel.465427.n5.nabble.com/multiple-camel-contexts-as-viewed-from-JMX-tp2265902p2265902.html

Route ids are being unique, so we should be able to do that for CamelContext id as well. And we should reject starting an application if an existing CamelContext exists with the same id. This applies to JMX.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-3031) Auto assigned CamelContext id should be unique in the JVM

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

Claus Ibsen commented on CAMEL-3031:
------------------------------------

{quote}
Is it not better to see if a context already exists and re-use it... ?
{quote}

No a CamelContext should really be isolated and live by itself. And this should also be reflected in JMX.


> Auto assigned CamelContext id should be unique in the JVM
> ---------------------------------------------------------
>
>                 Key: CAMEL-3031
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3031
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.5.0
>
>
> See nabble
> http://camel.465427.n5.nabble.com/multiple-camel-contexts-as-viewed-from-JMX-tp2265902p2265902.html
> Route ids are being unique, so we should be able to do that for CamelContext id as well. And we should reject starting an application if an existing CamelContext exists with the same id. This applies to JMX.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-3031) Auto assigned CamelContext id should be unique in the JVM

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

Willem Jiang commented on CAMEL-3031:
-------------------------------------

I just found there are something wrong with the CamelContextFactoryBean's createCamelContext.
It will set the camelcontext id with id name which could be an implicit one, and it will override the OsgiCamelContextNameStratgy which an ExplicitCamelContextNameStratgy.

So I made some change in the trunk: 984294

> Auto assigned CamelContext id should be unique in the JVM
> ---------------------------------------------------------
>
>                 Key: CAMEL-3031
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3031
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.5.0
>
>
> See nabble
> http://camel.465427.n5.nabble.com/multiple-camel-contexts-as-viewed-from-JMX-tp2265902p2265902.html
> Route ids are being unique, so we should be able to do that for CamelContext id as well. And we should reject starting an application if an existing CamelContext exists with the same id. This applies to JMX.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-3031) Auto assigned CamelContext id should be unique in the JVM

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

Claus Ibsen commented on CAMEL-3031:
------------------------------------

I will implement a check which will fail starting a CamelContext if another context has been registered in JMX with the same ObjectName

> Auto assigned CamelContext id should be unique in the JVM
> ---------------------------------------------------------
>
>                 Key: CAMEL-3031
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3031
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.5.0
>
>
> See nabble
> http://camel.465427.n5.nabble.com/multiple-camel-contexts-as-viewed-from-JMX-tp2265902p2265902.html
> Route ids are being unique, so we should be able to do that for CamelContext id as well. And we should reject starting an application if an existing CamelContext exists with the same id. This applies to JMX.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (CAMEL-3031) Auto assigned CamelContext id should be unique in the JVM

Posted by "Ashwin Karpe (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-3031?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61091#action_61091 ] 

Ashwin Karpe edited comment on CAMEL-3031 at 8/6/10 3:12 PM:
-------------------------------------------------------------

Hi Claus,

This is a rather serious issue. I also verified that direct endpoints for camel contexts with the same context id in 2 different bundles cannot see each other. However they can indeed see each other using VM endpoints.

It seems Camel creates 2 separate camel contexts ignoring the fact that they have the same context id. i would have thought Spring would not allow this to happen and would use an existing bean and not instantiate a fresh one if the id was the same. 

In JMX, however, Camel seems to lists both contexts against the same context id.

Not sure whether the fix should be that the route should not be instantiated if a context already exists under the same name. I would hae thought Spring beahvior would be to automatically use the existing bean of the given id instead of failing. Also is a bundle the determinant for failure...?
Would this not be a problem then for applications that use Spring but not OSGi and do want to re-use the camel context...

Is it not better to see if a context already exists and re-use it... ?

Regards,

Ashwin... 

      was (Author: akarpe):
    Hi Claus,

This is a rather serious issue. I also verified that direct endpoints for camel contexts with the same context id in 2 different bundles cannot see each other. However they can indeed see each other using VM endpoints.

It seems Spring creates 2 separate camel contexts ignoring the fact that they have the same context id. While in JMX it lists them against the same context id.

Not ure whether the fix should be that the route should not be instantiated if a context already exists under the same name. I would hae thought Spring would automatically use the existing bean of the given id instead of failing. Also is a bundle the determinant for failure...?
This would be a problem then for applications that use Spring but not OSGi...

Is it not better to see if a context already exists and re-use it... ?

Regards,

Ashwin... 
  
> Auto assigned CamelContext id should be unique in the JVM
> ---------------------------------------------------------
>
>                 Key: CAMEL-3031
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3031
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.5.0
>
>
> See nabble
> http://camel.465427.n5.nabble.com/multiple-camel-contexts-as-viewed-from-JMX-tp2265902p2265902.html
> Route ids are being unique, so we should be able to do that for CamelContext id as well. And we should reject starting an application if an existing CamelContext exists with the same id. This applies to JMX.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-3031) Auto assigned CamelContext id should be unique in the JVM

Posted by "Ashwin Karpe (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-3031?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61091#action_61091 ] 

Ashwin Karpe commented on CAMEL-3031:
-------------------------------------

Hi Claus,

This is a rather serious issue. I also verified that direct endpoints for camel contexts with the same context id in 2 different bundles cannot see each other. However they can indeed see each other using VM endpoints.

It seems Spring creates 2 separate camel contexts ignoring the fact that they have the same context id. While in JMX it lists them against the same context id.

Not ure whether the fix should be that the route should not be instantiated if a context already exists under the same name. I would hae thought Spring would automatically use the existing bean of the given id instead of failing. Also is a bundle the determinant for failure...?
This would be a problem then for applications that use Spring but not OSGi...

Is it not better to see if a context already exists and re-use it... ?

Regards,

Ashwin... 

> Auto assigned CamelContext id should be unique in the JVM
> ---------------------------------------------------------
>
>                 Key: CAMEL-3031
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3031
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.5.0
>
>
> See nabble
> http://camel.465427.n5.nabble.com/multiple-camel-contexts-as-viewed-from-JMX-tp2265902p2265902.html
> Route ids are being unique, so we should be able to do that for CamelContext id as well. And we should reject starting an application if an existing CamelContext exists with the same id. This applies to JMX.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (CAMEL-3031) Auto assigned CamelContext id should be unique in the JVM

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

Claus Ibsen reassigned CAMEL-3031:
----------------------------------

    Assignee: Claus Ibsen

> Auto assigned CamelContext id should be unique in the JVM
> ---------------------------------------------------------
>
>                 Key: CAMEL-3031
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3031
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.5.0
>
>
> See nabble
> http://camel.465427.n5.nabble.com/multiple-camel-contexts-as-viewed-from-JMX-tp2265902p2265902.html
> Route ids are being unique, so we should be able to do that for CamelContext id as well. And we should reject starting an application if an existing CamelContext exists with the same id. This applies to JMX.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-3031) Auto assigned CamelContext id should be unique in the JVM

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

Claus Ibsen commented on CAMEL-3031:
------------------------------------

When you define a <camelContext/> in a XML file, you have 2 choices
a) the id can be explicit given
b) no id given

In the former case Camel will use this id as the bean id in Spring ApplicationContext and as well for JMX.
In the latter Camel will auto assign an unique id to be used in Spring ApplicationContext and as well for JMX.

There are 2 problems with the current code

1)
When registering a CamelContext in JMX, Camel would ignore if an existing CamelContext with the same id was already registered. This means that you would end up with 2 different CamelContext's merged into the same. This means you cannot manage the 2nd CamelContext, for example to stop it etc as it would not be enlisted. Also when the 1st is unregistered, you would leave mbeans _hanging_ in there for the 2nd which doensn't have a CamelContext etc.  Also there are problems with clashes of endpoint uris, error handlers, tracers etc.

Bottom line we end up with mixed data. 

2)
In OSGi the auto assigned unique name is *not* unique because OSGi causes the atomic counter to be multiple instances so you end up with Camel ids' all being {{camel-1}}. This works in non OSGi environments such as WARs etc.


All these problems can of course be resolved by explicit assigning an unique id for you <camelContext>'s.


We will also try to enhance the auto assigned unique name in OSGi to include bundle id etc. so it brings more value for you. So if you bundle has given id 147, then the auto assigned id should be {{camel-147}} etc.



> Auto assigned CamelContext id should be unique in the JVM
> ---------------------------------------------------------
>
>                 Key: CAMEL-3031
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3031
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.5.0
>
>
> See nabble
> http://camel.465427.n5.nabble.com/multiple-camel-contexts-as-viewed-from-JMX-tp2265902p2265902.html
> Route ids are being unique, so we should be able to do that for CamelContext id as well. And we should reject starting an application if an existing CamelContext exists with the same id. This applies to JMX.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-3031) Auto assigned CamelContext id should be unique in the JVM

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

Willem Jiang commented on CAMEL-3031:
-------------------------------------

@Claus,

I just didn't some test about camelContext name within the OSGi container,  I don't find the issue of static atomic counter which causes all the camel id end up with camel-1.
But I agree to add the bundle id in to the camelContext which will help user to find their camel context easily.



> Auto assigned CamelContext id should be unique in the JVM
> ---------------------------------------------------------
>
>                 Key: CAMEL-3031
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3031
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.5.0
>
>
> See nabble
> http://camel.465427.n5.nabble.com/multiple-camel-contexts-as-viewed-from-JMX-tp2265902p2265902.html
> Route ids are being unique, so we should be able to do that for CamelContext id as well. And we should reject starting an application if an existing CamelContext exists with the same id. This applies to JMX.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CAMEL-3031) Auto assigned CamelContext id should be unique in the JVM

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

Claus Ibsen resolved CAMEL-3031.
--------------------------------

    Resolution: Fixed

trunk: 983197.

> Auto assigned CamelContext id should be unique in the JVM
> ---------------------------------------------------------
>
>                 Key: CAMEL-3031
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3031
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.5.0
>
>
> See nabble
> http://camel.465427.n5.nabble.com/multiple-camel-contexts-as-viewed-from-JMX-tp2265902p2265902.html
> Route ids are being unique, so we should be able to do that for CamelContext id as well. And we should reject starting an application if an existing CamelContext exists with the same id. This applies to JMX.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-3031) Auto assigned CamelContext id should be unique in the JVM

Posted by "Ashwin Karpe (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-3031?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61092#action_61092 ] 

Ashwin Karpe commented on CAMEL-3031:
-------------------------------------

Hi Claus,

Ben and I are working on the same customer project where we ran into this issue. The version of Camel that the customer is using is Camel version 2.2. The deployment is on a FUSE OSGi container version 4.2.0

Hope this helps.

Cheers,

Ashwin...
 

> Auto assigned CamelContext id should be unique in the JVM
> ---------------------------------------------------------
>
>                 Key: CAMEL-3031
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3031
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.5.0
>
>
> See nabble
> http://camel.465427.n5.nabble.com/multiple-camel-contexts-as-viewed-from-JMX-tp2265902p2265902.html
> Route ids are being unique, so we should be able to do that for CamelContext id as well. And we should reject starting an application if an existing CamelContext exists with the same id. This applies to JMX.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.