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/04/15 13:26:43 UTC

[jira] Created: (CAMEL-2650) @Produce and @Consume injected on prototype beans needs a mechanism for automatic stopping when no longer in use

@Produce and @Consume injected on prototype beans needs a mechanism for automatic stopping when no longer in use
----------------------------------------------------------------------------------------------------------------

                 Key: CAMEL-2650
                 URL: https://issues.apache.org/activemq/browse/CAMEL-2650
             Project: Apache Camel
          Issue Type: Improvement
          Components: camel-spring
    Affects Versions: 2.2.0
            Reporter: Claus Ibsen
             Fix For: Future


This only applies for prototype scoped POJOs which uses @Produce or @Consume to inject a Camel Producer/Consumer.

As the prototype scoped POJO is short lived and there could potentially be created many of those POJOs.
Then @Produce / @Consume will inject new instances of Producer / Consumer as well.

And since there is no standard way of knowing when the POJO is no longer in need, which is where we can to stop the Producer/Consumer.

For singleton scoped this is not a problem as CamelContext will keep track on the created Producer/Consumer in its internal _servicesToClose_.
Which is then stopped when CamelContext stops.

For prototype we need a different strategy such as
- proxy it to use pooled producers/consumers which CamelContext manage the lifecycle
- use a shared ProducerTemplate / ConsumerTemplate instead which CamelContext manages the lifecycle
- other
- maybe some thread local tricks



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (CAMEL-2650) @Produce and @Consume injected on prototype beans needs a mechanism for automatic stopping when no longer in use

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

Claus Ibsen commented on CAMEL-2650:
------------------------------------

 Using @Produce or other Camel injected services will not consider singleton or prototype scope beans. For prototype scoped a WARN is logged about the need to manually stop the service after usage."

trunk: 934731.

> @Produce and @Consume injected on prototype beans needs a mechanism for automatic stopping when no longer in use
> ----------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-2650
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2650
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-spring
>    Affects Versions: 2.2.0
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: Future
>
>
> This only applies for prototype scoped POJOs which uses @Produce or @Consume to inject a Camel Producer/Consumer.
> As the prototype scoped POJO is short lived and there could potentially be created many of those POJOs.
> Then @Produce / @Consume will inject new instances of Producer / Consumer as well.
> And since there is no standard way of knowing when the POJO is no longer in need, which is where we can to stop the Producer/Consumer.
> For singleton scoped this is not a problem as CamelContext will keep track on the created Producer/Consumer in its internal _servicesToClose_.
> Which is then stopped when CamelContext stops.
> For prototype we need a different strategy such as
> - proxy it to use pooled producers/consumers which CamelContext manage the lifecycle
> - use a shared ProducerTemplate / ConsumerTemplate instead which CamelContext manages the lifecycle
> - other
> - maybe some thread local tricks

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Assigned: (CAMEL-2650) @Produce and @Consume injected on prototype beans needs a mechanism for automatic stopping when no longer in use

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

Claus Ibsen reassigned CAMEL-2650:
----------------------------------

    Assignee: Claus Ibsen

> @Produce and @Consume injected on prototype beans needs a mechanism for automatic stopping when no longer in use
> ----------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-2650
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2650
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-spring
>    Affects Versions: 2.2.0
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: Future
>
>
> This only applies for prototype scoped POJOs which uses @Produce or @Consume to inject a Camel Producer/Consumer.
> As the prototype scoped POJO is short lived and there could potentially be created many of those POJOs.
> Then @Produce / @Consume will inject new instances of Producer / Consumer as well.
> And since there is no standard way of knowing when the POJO is no longer in need, which is where we can to stop the Producer/Consumer.
> For singleton scoped this is not a problem as CamelContext will keep track on the created Producer/Consumer in its internal _servicesToClose_.
> Which is then stopped when CamelContext stops.
> For prototype we need a different strategy such as
> - proxy it to use pooled producers/consumers which CamelContext manage the lifecycle
> - use a shared ProducerTemplate / ConsumerTemplate instead which CamelContext manages the lifecycle
> - other
> - maybe some thread local tricks

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira