-
1. Re: How to call a Bean with parameters ?
davsclaus Jan 23, 2009 12:27 AM (in response to jklemm)Hi
Interessting idea. But currently you can not pass in additional parameters with the bean component.
Its purpose is to invoke a bean with your Exchange/Message as parameters. But I can see a valid point in having some additional parameters provided. However as the JVM runtime dont keep the parameter name we only have the types (and the order) in the parameter list and wont be able to match against a parameter name from the URI.
We could support this by bean binding using annotations. We could add a new annotation to allow you to specify additional parameters and then you can mark them in the method.
And maybe we can support a non annotation solution if there is only one extra parameter and only one parameter provided in the URI.
http://camel.apache.org/bean-integration.html
-
2. Re: How to call a Bean with parameters ?
davsclaus Jan 23, 2009 2:36 AM (in response to davsclaus)Hi
I have created a ticket at Apache to have this idea out in the open
-
3. Re: How to call a Bean with parameters ?
jklemm Jan 23, 2009 1:26 PM (in response to davsclaus)So, I think that it will be useful.
Thanks!!
-
4. Re: How to call a Bean with parameters ?
njiang Feb 5, 2009 12:19 AM (in response to davsclaus)I just add a comment in the CAMEL-1293, please check it out
-
5. Re: How to call a Bean with parameters ?
balakumar1982 Nov 11, 2013 7:10 AM (in response to jklemm)In addition to way show in link http://camel.apache.org/bean-binding.html, we had problem in our application where we have two parameter for method which both are string.
We have managed it to solve by using below
.to("bean:orderService?method=doSomething(${body[0]}, ${body[1]})")
Above picks the value from MessageContentList in the order specified. We can simple expression in a filter to check the size of list to avoid ArrayIndexOutOfBound Exception.
Edited by: balakumar1982 on Nov 11, 2013 12:07 PM