camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
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 <> 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 <> 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
>> (,
>> I
>> started thinking that I might not need to write this.
>> Accordingly, I had some follow-up questions here that I hope are clear:
>> 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:
>> Sent from the Camel - Users mailing list archive at
> --
> Matt Sicker <>

Claus Ibsen
Red Hat, Inc.
Twitter: davsclaus
Author of Camel in Action:

View raw message