camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Claus - Need better understanding of Camel "bean" tag usage with Spring prototype beans
Date Thu, 04 Sep 2014 06:45:08 GMT
On Thu, Sep 4, 2014 at 4:11 AM, Matt Sicker <boards@gmail.com> wrote:
> I believe beans are used however the container defines them. If you're
> using prototype beans, then I'd imagine it creates a new one for every
> lookup, but that would depend on how Spring works under the hood.
>

Yeah there is a cache option you can use to tell Camel to cache the
instance and reuse the same instance, or if cache=false then Camel
will lookup on each processing, but then in the end it also depends
how its configured in spring/blueprint etc. As if its defines as a
singleton scope then its the same instance anyway.

Mind there was a issue with the cache option in Camel, that is fixed
for 2.14.0 - see the release notes.

>
> On 3 September 2014 09:12, rickaroni <rgfanta@directv.com> wrote:
>
>> Hi Claus,
>>
>> I'm still a bit confused with precisely how the Camel "bean" tag works and
>> interacts with Spring prototype beans.
>>
>> With similar ESB's to Camel, I've seen folks write their own Spring custom
>> scope such that the same bean is used from when the input message received
>> by the ESB to when the output message sent from the ESB to the next stage.
>>
>> After reading your great reply to this post
>> (http://camel.465427.n5.nabble.com/Bean-s-scope-in-Camel-td5737137.html),
>> I
>> started thinking that I might not need to write this.
>>
>> Accordingly, I had some follow-up questions here that I hope are clear:
>>
>> http://camel.465427.n5.nabble.com/lt-to-quot-bean-xxx-quot-or-not-lt-to-quot-bean-xxx-quot-Getting-clarity-on-bean-scope-td5754593.html
>>
>> Basically, if I have a spring prototype bean declared in my spring config
>> (e.g. myAwesomeBean), and multiple calls to it in one or more routes (e.g.
>> calls to myBeanMethod2, 3, and 4 in ROUTE2 and ROUTE3), is the same bean
>> instance used throughout???
>>
>> Where can I look to get a better understanding of Camel "bean" tag usage
>> (or
>> use of a bean as a "to" destination) and the lifetime of a Spring
>> "prototype" bean within a Camel route??
>>
>> Many thanks in advance for any help you can offer.
>>
>> Rick
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/Claus-Need-better-understanding-of-Camel-bean-tag-usage-with-Spring-prototype-beans-tp5756009.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>
>
>
> --
> Matt Sicker <boards@gmail.com>



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Mime
View raw message