camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bilgin Ibryam <bibr...@gmail.com>
Subject Re: Dealing with a bean's return values
Date Thu, 09 Feb 2012 02:05:48 GMT
yes, the result from the bean call is stored in the body of the
exchange, UNLESS the method returns null. If the bean returns null the
result is ignored (as in your case).

May be it is better in your case, to return a value different than
null to indicate error, or set a header on the exchange.

Bilgin

On 8 February 2012 13:19, Gershaw, Geoffrey
<geoffrey.gershaw@credit-suisse.com> wrote:
> Hi Bilgin,
>
> Thanks very much. That is exactly what I am looking for.  I couldn't figure out where
the result of the method call was located. Is the return value of this bean set as the body
on the input msg of the Exhange? I am assuming yes from your solution.
> <camel:bean ref="secDefConverter" method="convert"/>
>
> Thanks again,
>
> Geoff
>
>
> -----Original Message-----
> From: Bilgin Ibryam [mailto:bibryam@gmail.com]
> Sent: Tuesday, February 07, 2012 9:27 PM
> To: users@camel.apache.org
> Subject: Re: Dealing with a bean's return values
>
> Hi Geoff,
>
> If I got it right, you are trying to achieve something like this:
>
>        <camel:filter>
>
> <camel:simple>${bean:securityBean?method=interested}</camel:simple>
>                <camel:bean ref="secDefConverter" method="convert"/>
>                <camel:filter>
>                     <camel:simple>${body} != null</camel:simple>
>                     <camel:stop/>
>                </camel:filter>
>
>                          otherwise continue processing
>
>            </camel:filter>
>
> Just make sure the null check is correct.
>
> HTH
> Bilgin
>
>
>
>
>
>
> On 7 February 2012 22:33, Gershaw, Geoffrey
> <geoffrey.gershaw@credit-suisse.com> wrote:
>> Hello,
>>
>>
>>
>> Hoping that someone can help me with beans in my route. I have created
>> the following route. I am using 3 beans in the route.
>>
>>
>>
>> 1.       SecurityDefinitionFilter returns Boolean if we are interested
>> in this SecurityDefinition
>>
>> 2.  SecDefConverter transforms SecurityDefinition to a CXRefData object.
>> Returns null if there is a problem during transformation.
>>
>> 3.  CXRefDataCache caches the CXRefData object. Doesn't handle null.
>>
>>
>>
>>            <route >
>>
>>                  <from uri="direct:processSecurityDefinition" />
>>
>>                        <filter>
>>
>>
>> <simple>${bean:SecurityDefinitionFilter}</simple><!--  Only process
CDX
>> -->
>>
>>                              <bean ref="SecDefConverter"
>> method="convert"/><!--  SecDef to CXRefData   -->
>>
>>                              <bean ref="CXRefDataCache"
>> method="put"/><!-- Cache RefData-->
>>
>>                        </filter>
>>
>>            </route>
>>
>> If a null value is returned by SecDefConverter.convert, I would like to
>> filter out(stop moving forward in the route).
>>
>> If a non-null value is returned from SecDefConverter.convert, it  should
>> be passed to CXRefDataCache
>>
>>
>>
>> Thanks,
>>
>>
>>
>> Geoff
>>
>>
>> ===============================================================================
>> Please access the attached hyperlink for an important electronic communications disclaimer:
>> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
>> ===============================================================================
>>
>
> ===============================================================================
> Please access the attached hyperlink for an important electronic communications disclaimer:
> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
> ===============================================================================
>

Mime
View raw message