You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2015/03/25 09:25:52 UTC

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

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

Claus Ibsen resolved CAMEL-2650.
--------------------------------
    Resolution: Won't Fix
      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/jira/browse/CAMEL-2650
>             Project: 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 was sent by Atlassian JIRA
(v6.3.4#6332)