You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by logesh <lo...@gmail.com> on 2024/07/05 15:32:51 UTC
Camel bean
I am trying to use bean with reference and method call.The bean has
overloaded methods and hence it is being called in this way.The below
method call was populated with parameter type and value in reference to the
guidanct provided in here.
https://camel.apache.org/manual/bean-binding.html#_declaring_parameter_type_and_value
My bean spring DSL looks as below
<bean ref=bean1 method="Sendmsg(java.lang.String.class ${body},
Java.lang.String.class {{appsproperty.value}})"
I get ambiguous method invocation possible exception.
On investigating further this was drilled down to issue happening during
the matchmethod call in BeanInfo class under org.apache.camel.component.
The matchmethod was calling the method splitsafequote method with 4
parameters (input seperator trime:true and keepquote:true) in
strignquotehelper class under org.apache.camel.util which splits the
parameters and types.The problem was isolated to the type and value
concatenated with space between them ignored.The flag skipleadingwhitespace
is set to true and is never changed which ignores the space and is missed
in the parsing logic.
This in turn breaks at the match method which looks for the indexof(32)
which is for a whitespace and since it's not there it returns -1 and there
by breaking the whole purpose of passing parameter type and value.
Camel version used :4.5.0
Camel components:camel-bean and camel-util
Please let know if this is a bug or if any missing configuration from.my
side
PS:I changed the flag to false and it works fine with the above bean method
call
Thanks
Logeshwaran Devakar
Re: Camel bean 4.8.1 toD uri issue
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
What you do with <to> is correct. You specify the method signature that
Camel should call.
The bean component is able to adapt to this.
Using toD is not needed and it has a different purpose here. The <toD> will
calculate a literal uri string ahead of time.
This means the simple expression values are added together as a string.
On Mon, Feb 10, 2025 at 7:59 AM logesh <lo...@gmail.com> wrote:
> In that case are we isolating just to string based methods for toD and
> custom wont me supported?
>
> On Mon, Feb 10, 2025, 1:05 PM Claus Ibsen <cl...@gmail.com> wrote:
>
> > Hi
> >
> > This is as designed when you use toD then you use the simple language
> that
> > are literal/string based.
> > Avoid all the method overload complexity and just use a new method name.
> >
> >
> >
> > On Mon, Feb 10, 2025 at 8:08 AM logesh <lo...@gmail.com> wrote:
> >
> > > Hi,
> > >
> > > We have another issue with camel bean and methid invocation but this
> > time
> > > its on the bean menthod invocation thats done thru toD uri. Calling a
> > bean
> > > method using the below snippet works when access the header stored
> > > properties .the property1 in headers gets resolved to the custom class
> > type
> > > and gets called to the correct overloaded method in the bean.
> > > <bean ref="bean-ref" method="method1(${body}, <custom class
> type>.class
> > > ${headers[property1]})">
> > >
> > > But when the same bean is called thru the
> > > The below snippet the property1 under headers is always resolved as
> > string
> > > and it ends up being called as a string parameter there by throwing
> > method
> > > invocation error.
> > > <toD uri="bean-ref?method1(${body}, <custom class type>.class
> > > ${headers[property1]})">
> > >
> > > The very purpose we are using toD is for Dynamic routing to the
> required
> > > bean reference there by limiting us to just configurations on the route
> > > DSL.Any advise on this issue or fix is highly appreciated.
> > >
> > > *Camel version:4.8.1*
> > > *Springboot based app: 3.3.5*
> > >
> > > Thanks
> > > Logeshwaran Devakar
> > >
> > >
> > > On Fri, Jul 5, 2024, 9:02 PM logesh <lo...@gmail.com> wrote:
> > >
> > > > I am trying to use bean with reference and method call.The bean has
> > > > overloaded methods and hence it is being called in this way.The below
> > > > method call was populated with parameter type and value in reference
> to
> > > the
> > > > guidanct provided in here.
> > > >
> > > >
> > >
> >
> https://camel.apache.org/manual/bean-binding.html#_declaring_parameter_type_and_value
> > > >
> > > > My bean spring DSL looks as below
> > > >
> > > > <bean ref=bean1 method="Sendmsg(java.lang.String.class ${body},
> > > > Java.lang.String.class {{appsproperty.value}})"
> > > >
> > > > I get ambiguous method invocation possible exception.
> > > > On investigating further this was drilled down to issue happening
> > during
> > > > the matchmethod call in BeanInfo class under
> > org.apache.camel.component.
> > > >
> > > > The matchmethod was calling the method splitsafequote method with 4
> > > > parameters (input seperator trime:true and keepquote:true) in
> > > > strignquotehelper class under org.apache.camel.util which splits the
> > > > parameters and types.The problem was isolated to the type and value
> > > > concatenated with space between them ignored.The flag
> > > skipleadingwhitespace
> > > > is set to true and is never changed which ignores the space and is
> > missed
> > > > in the parsing logic.
> > > > This in turn breaks at the match method which looks for the
> indexof(32)
> > > > which is for a whitespace and since it's not there it returns -1 and
> > > there
> > > > by breaking the whole purpose of passing parameter type and value.
> > > >
> > > > Camel version used :4.5.0
> > > > Camel components:camel-bean and camel-util
> > > >
> > > > Please let know if this is a bug or if any missing configuration
> > from.my
> > > > side
> > > >
> > > > PS:I changed the flag to false and it works fine with the above bean
> > > > method call
> > > >
> > > > Thanks
> > > > Logeshwaran Devakar
> > > >
> > > >
> > > >
> > >
> >
> >
> > --
> > Claus Ibsen
> > -----------------
> > @davsclaus
> > Camel in Action 2: https://www.manning.com/ibsen2
> >
>
--
Claus Ibsen
-----------------
@davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
Re: Camel bean 4.8.1 toD uri issue
Posted by logesh <lo...@gmail.com>.
In that case are we isolating just to string based methods for toD and
custom wont me supported?
On Mon, Feb 10, 2025, 1:05 PM Claus Ibsen <cl...@gmail.com> wrote:
> Hi
>
> This is as designed when you use toD then you use the simple language that
> are literal/string based.
> Avoid all the method overload complexity and just use a new method name.
>
>
>
> On Mon, Feb 10, 2025 at 8:08 AM logesh <lo...@gmail.com> wrote:
>
> > Hi,
> >
> > We have another issue with camel bean and methid invocation but this
> time
> > its on the bean menthod invocation thats done thru toD uri. Calling a
> bean
> > method using the below snippet works when access the header stored
> > properties .the property1 in headers gets resolved to the custom class
> type
> > and gets called to the correct overloaded method in the bean.
> > <bean ref="bean-ref" method="method1(${body}, <custom class type>.class
> > ${headers[property1]})">
> >
> > But when the same bean is called thru the
> > The below snippet the property1 under headers is always resolved as
> string
> > and it ends up being called as a string parameter there by throwing
> method
> > invocation error.
> > <toD uri="bean-ref?method1(${body}, <custom class type>.class
> > ${headers[property1]})">
> >
> > The very purpose we are using toD is for Dynamic routing to the required
> > bean reference there by limiting us to just configurations on the route
> > DSL.Any advise on this issue or fix is highly appreciated.
> >
> > *Camel version:4.8.1*
> > *Springboot based app: 3.3.5*
> >
> > Thanks
> > Logeshwaran Devakar
> >
> >
> > On Fri, Jul 5, 2024, 9:02 PM logesh <lo...@gmail.com> wrote:
> >
> > > I am trying to use bean with reference and method call.The bean has
> > > overloaded methods and hence it is being called in this way.The below
> > > method call was populated with parameter type and value in reference to
> > the
> > > guidanct provided in here.
> > >
> > >
> >
> https://camel.apache.org/manual/bean-binding.html#_declaring_parameter_type_and_value
> > >
> > > My bean spring DSL looks as below
> > >
> > > <bean ref=bean1 method="Sendmsg(java.lang.String.class ${body},
> > > Java.lang.String.class {{appsproperty.value}})"
> > >
> > > I get ambiguous method invocation possible exception.
> > > On investigating further this was drilled down to issue happening
> during
> > > the matchmethod call in BeanInfo class under
> org.apache.camel.component.
> > >
> > > The matchmethod was calling the method splitsafequote method with 4
> > > parameters (input seperator trime:true and keepquote:true) in
> > > strignquotehelper class under org.apache.camel.util which splits the
> > > parameters and types.The problem was isolated to the type and value
> > > concatenated with space between them ignored.The flag
> > skipleadingwhitespace
> > > is set to true and is never changed which ignores the space and is
> missed
> > > in the parsing logic.
> > > This in turn breaks at the match method which looks for the indexof(32)
> > > which is for a whitespace and since it's not there it returns -1 and
> > there
> > > by breaking the whole purpose of passing parameter type and value.
> > >
> > > Camel version used :4.5.0
> > > Camel components:camel-bean and camel-util
> > >
> > > Please let know if this is a bug or if any missing configuration
> from.my
> > > side
> > >
> > > PS:I changed the flag to false and it works fine with the above bean
> > > method call
> > >
> > > Thanks
> > > Logeshwaran Devakar
> > >
> > >
> > >
> >
>
>
> --
> Claus Ibsen
> -----------------
> @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>
Re: Camel bean 4.8.1 toD uri issue
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
This is as designed when you use toD then you use the simple language that
are literal/string based.
Avoid all the method overload complexity and just use a new method name.
On Mon, Feb 10, 2025 at 8:08 AM logesh <lo...@gmail.com> wrote:
> Hi,
>
> We have another issue with camel bean and methid invocation but this time
> its on the bean menthod invocation thats done thru toD uri. Calling a bean
> method using the below snippet works when access the header stored
> properties .the property1 in headers gets resolved to the custom class type
> and gets called to the correct overloaded method in the bean.
> <bean ref="bean-ref" method="method1(${body}, <custom class type>.class
> ${headers[property1]})">
>
> But when the same bean is called thru the
> The below snippet the property1 under headers is always resolved as string
> and it ends up being called as a string parameter there by throwing method
> invocation error.
> <toD uri="bean-ref?method1(${body}, <custom class type>.class
> ${headers[property1]})">
>
> The very purpose we are using toD is for Dynamic routing to the required
> bean reference there by limiting us to just configurations on the route
> DSL.Any advise on this issue or fix is highly appreciated.
>
> *Camel version:4.8.1*
> *Springboot based app: 3.3.5*
>
> Thanks
> Logeshwaran Devakar
>
>
> On Fri, Jul 5, 2024, 9:02 PM logesh <lo...@gmail.com> wrote:
>
> > I am trying to use bean with reference and method call.The bean has
> > overloaded methods and hence it is being called in this way.The below
> > method call was populated with parameter type and value in reference to
> the
> > guidanct provided in here.
> >
> >
> https://camel.apache.org/manual/bean-binding.html#_declaring_parameter_type_and_value
> >
> > My bean spring DSL looks as below
> >
> > <bean ref=bean1 method="Sendmsg(java.lang.String.class ${body},
> > Java.lang.String.class {{appsproperty.value}})"
> >
> > I get ambiguous method invocation possible exception.
> > On investigating further this was drilled down to issue happening during
> > the matchmethod call in BeanInfo class under org.apache.camel.component.
> >
> > The matchmethod was calling the method splitsafequote method with 4
> > parameters (input seperator trime:true and keepquote:true) in
> > strignquotehelper class under org.apache.camel.util which splits the
> > parameters and types.The problem was isolated to the type and value
> > concatenated with space between them ignored.The flag
> skipleadingwhitespace
> > is set to true and is never changed which ignores the space and is missed
> > in the parsing logic.
> > This in turn breaks at the match method which looks for the indexof(32)
> > which is for a whitespace and since it's not there it returns -1 and
> there
> > by breaking the whole purpose of passing parameter type and value.
> >
> > Camel version used :4.5.0
> > Camel components:camel-bean and camel-util
> >
> > Please let know if this is a bug or if any missing configuration from.my
> > side
> >
> > PS:I changed the flag to false and it works fine with the above bean
> > method call
> >
> > Thanks
> > Logeshwaran Devakar
> >
> >
> >
>
--
Claus Ibsen
-----------------
@davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
Re: Camel bean 4.8.1 toD uri issue
Posted by logesh <lo...@gmail.com>.
Hi,
We have another issue with camel bean and methid invocation but this time
its on the bean menthod invocation thats done thru toD uri. Calling a bean
method using the below snippet works when access the header stored
properties .the property1 in headers gets resolved to the custom class type
and gets called to the correct overloaded method in the bean.
<bean ref="bean-ref" method="method1(${body}, <custom class type>.class
${headers[property1]})">
But when the same bean is called thru the
The below snippet the property1 under headers is always resolved as string
and it ends up being called as a string parameter there by throwing method
invocation error.
<toD uri="bean-ref?method1(${body}, <custom class type>.class
${headers[property1]})">
The very purpose we are using toD is for Dynamic routing to the required
bean reference there by limiting us to just configurations on the route
DSL.Any advise on this issue or fix is highly appreciated.
*Camel version:4.8.1*
*Springboot based app: 3.3.5*
Thanks
Logeshwaran Devakar
On Fri, Jul 5, 2024, 9:02 PM logesh <lo...@gmail.com> wrote:
> I am trying to use bean with reference and method call.The bean has
> overloaded methods and hence it is being called in this way.The below
> method call was populated with parameter type and value in reference to the
> guidanct provided in here.
>
> https://camel.apache.org/manual/bean-binding.html#_declaring_parameter_type_and_value
>
> My bean spring DSL looks as below
>
> <bean ref=bean1 method="Sendmsg(java.lang.String.class ${body},
> Java.lang.String.class {{appsproperty.value}})"
>
> I get ambiguous method invocation possible exception.
> On investigating further this was drilled down to issue happening during
> the matchmethod call in BeanInfo class under org.apache.camel.component.
>
> The matchmethod was calling the method splitsafequote method with 4
> parameters (input seperator trime:true and keepquote:true) in
> strignquotehelper class under org.apache.camel.util which splits the
> parameters and types.The problem was isolated to the type and value
> concatenated with space between them ignored.The flag skipleadingwhitespace
> is set to true and is never changed which ignores the space and is missed
> in the parsing logic.
> This in turn breaks at the match method which looks for the indexof(32)
> which is for a whitespace and since it's not there it returns -1 and there
> by breaking the whole purpose of passing parameter type and value.
>
> Camel version used :4.5.0
> Camel components:camel-bean and camel-util
>
> Please let know if this is a bug or if any missing configuration from.my
> side
>
> PS:I changed the flag to false and it works fine with the above bean
> method call
>
> Thanks
> Logeshwaran Devakar
>
>
>
Re: Camel bean
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Sounds a bit complex, but you are welcome to create a JIRA.
And provide some sample code that demonstrates this. Or see if you dare to
add some kind of unit test that reproduces this, and works with your fix.
On Fri, Jul 5, 2024 at 5:33 PM logesh <lo...@gmail.com> wrote:
> I am trying to use bean with reference and method call.The bean has
> overloaded methods and hence it is being called in this way.The below
> method call was populated with parameter type and value in reference to the
> guidanct provided in here.
>
> https://camel.apache.org/manual/bean-binding.html#_declaring_parameter_type_and_value
>
> My bean spring DSL looks as below
>
> <bean ref=bean1 method="Sendmsg(java.lang.String.class ${body},
> Java.lang.String.class {{appsproperty.value}})"
>
> I get ambiguous method invocation possible exception.
> On investigating further this was drilled down to issue happening during
> the matchmethod call in BeanInfo class under org.apache.camel.component.
>
> The matchmethod was calling the method splitsafequote method with 4
> parameters (input seperator trime:true and keepquote:true) in
> strignquotehelper class under org.apache.camel.util which splits the
> parameters and types.The problem was isolated to the type and value
> concatenated with space between them ignored.The flag skipleadingwhitespace
> is set to true and is never changed which ignores the space and is missed
> in the parsing logic.
> This in turn breaks at the match method which looks for the indexof(32)
> which is for a whitespace and since it's not there it returns -1 and there
> by breaking the whole purpose of passing parameter type and value.
>
> Camel version used :4.5.0
> Camel components:camel-bean and camel-util
>
> Please let know if this is a bug or if any missing configuration from.my
> side
>
> PS:I changed the flag to false and it works fine with the above bean method
> call
>
> Thanks
> Logeshwaran Devakar
>
--
Claus Ibsen
-----------------
@davsclaus
Camel in Action 2: https://www.manning.com/ibsen2