Hi Guys,

according to the camel documentation I have two different options to invoke
a method of a bean. 


/// Explicit selection of bean method to be invoked.
from("direct:start").bean(new ExampleBean(), "methodName");
 
// Camel will create the instance of bean and cache it for you.
from("direct:start").bean(ExampleBean.class);/

I guess the first solution creates a new bean instance every time. The
second one caches the instance of the object, but what does that mean
explicitly? How long is the object available? During one invocation or for
the whole lifecycle of my Webservice?

I'll give you an example, within my route I have the following:

.bean(MyBeanA.class, "doMyBeanA")
.bean(MyBeanB.class, "doMyBeanB")
.bean(MyBeanA.class, "doMyBeanA2")

I must invoke one method of one bean, then one method of another bean and
finally another method of the first bean. I want to avoid to create more
than one instance of MyBeanA. Every instance of every bean should be created
just once per route-invocation.

I hope It was understandable, maybe one of you can give me a hint. Thank you
in advance

regards







--
View this message in context: 
http://camel.465427.n5.nabble.com/Bean-invocation-class-vs-new-tp5764039.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to