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: Issue w/ multi-parameter bean methods
Date Tue, 21 Dec 2010 09:48:37 GMT
On Tue, Dec 21, 2010 at 10:39 AM, Claus Ibsen <claus.ibsen@gmail.com> wrote:
> You are aware that you do NOT have any MY_ID header when you invoke
> the logStart method on the bean, since the message has just been
> consumed from a file. Therefore it only contains the CamelFileName
> header.
>
> Camel is then not able to map this header.
>

A plain example works
http://svn.apache.org/viewvc?rev=1051434&view=rev

But from your stacktrace it looks like you do some proxy on the bean
instances which may give trouble when Camel introspects the bean.



>
> On Sun, Dec 19, 2010 at 11:00 PM, Craig Taylor <ctalkobt@ctalkobt.net> wrote:
>> I've gotten around the problem by turning it into a processor but the route
>> was pro grammatically generated as
>>
>> from( "file:/home/myuser/data/in")
>>   .to( "bean:myLogger?method=logStart" )
>>   .process( processor1 )
>>   .to( "bean:myLogger?method=logEnd" );
>>
>> I'll try and come up with an isolated test case I can post to later.
>>
>> On Sat, Dec 18, 2010 at 6:23 AM, Claus Ibsen <claus.ibsen@gmail.com> wrote:
>>
>>> Can you post Camel version used and the route you are using?
>>>
>>>
>>> On Fri, Dec 17, 2010 at 6:42 PM, Craig Taylor <ctalkobt@ctalkobt.net>
>>> wrote:
>>> > I'm attempting to fire a bean method "logStart" and am receiving a
>>> > conversion error as it appears it's treating my initial integer parameter
>>> as
>>> > the body.  From trace logs:
>>> >
>>> > 12:33:17,297 | TRACE | tenerContainer-1 | BeanInfo
>>>   |
>>> > he.camel.component.bean.BeanInfo  296 | Creating MethodInfo for class:
>>> class
>>> > $Proxy187 method: public final void
>>> > $Proxy187.logStart(java.lang.Integer,java.lang.Strin
>>> > 12:33:17,297 | TRACE | tenerContainer-1 | BeanInfo
>>>   |
>>> > he.camel.component.bean.BeanInfo  307 | Parameter #0:
>>> ParameterInfo[index=0,
>>> > type=class java.lang.Integer, annotations=[], expression=null]
>>> > 12:33:17,297 | TRACE | tenerContainer-1 | BeanInfo
>>>   |
>>> > he.camel.component.bean.BeanInfo  328 | Parameter #0 is the body
>>> parameter
>>> > using expression mandatoryBodyAs[java.lang.Integer]
>>> > 12:33:17,297 | TRACE | tenerContainer-1 | BeanInfo
>>>   |
>>> > he.camel.component.bean.BeanInfo  337 | Parameter #0 has parameter info:
>>> > ParameterInfo[index=0, type=class java.lang.Integer, annotations=[],
>>> > expression=mandatoryBod
>>> > 12:33:17,298 | TRACE | tenerContainer-1 | BeanInfo
>>>   |
>>> > he.camel.component.bean.BeanInfo  307 | Parameter #1:
>>> ParameterInfo[index=1,
>>> > type=class java.lang.String, annotations=[], expression=null]
>>> > 12:33:17,298 | TRACE | tenerContainer-1 | BeanInfo
>>>   |
>>> > he.camel.component.bean.BeanInfo  337 | Parameter #1 has parameter info:
>>> > ParameterInfo[index=1, type=class java.lang.String, annotations=[],
>>> > expression=null]
>>> > 12:33:17,298 | TRACE | tenerContainer-1 | MethodInfo
>>>   |
>>> > .camel.component.bean.MethodInfo  220 | Creating parameters expression
>>> for 2
>>> > parameters
>>> > 12:33:17,298 | TRACE | tenerContainer-1 | MethodInfo
>>>   |
>>> > .camel.component.bean.MethodInfo  228 | Parameter #0 has expression:
>>> > mandatoryBodyAs[java.lang.Integer]
>>> > 12:33:17,298 | TRACE | tenerContainer-1 | MethodInfo
>>>   |
>>> > .camel.component.bean.MethodInfo  228 | Parameter #1 has expression: null
>>> >
>>> > where my function definition is :
>>> >
>>> > @Handler
>>> >    public void logStart( @Header("MY_ID") Integer myId,
>>> > @Header("CamelFileName") String filename )
>>> >
>>> > Changing the Integer myId, and the associated setHeader to strings
>>> > apparently causes this to work.  I'd much prefer to use an integer id
>>> rather
>>> > than a string.
>>> >
>>> >
>>> > --
>>> > -------------------------------------------
>>> > Craig Taylor
>>> > ctalkobt@ctalkobt.net
>>> >
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> -----------------
>>> FuseSource
>>> Email: cibsen@fusesource.com
>>> Web: http://fusesource.com
>>> Twitter: davsclaus
>>> Blog: http://davsclaus.blogspot.com/
>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>>
>>
>>
>>
>> --
>> -------------------------------------------
>> Craig Taylor
>> ctalkobt@ctalkobt.net
>>
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Mime
View raw message