You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Gershaw, Geoffrey" <ge...@credit-suisse.com> on 2012/06/18 23:49:04 UTC
Simple language question
Hello all,
I am using the Spring DSL with the Filter EIP. The below snippet works,
but its confusing. I am trying to include a msg with a non-null body
the outcome of bean:CXRefDataCache?method=put equals false.
Is there a cleaner way?
<filter>
<!-- Only process valid (non-null) SecDefs. cache CXRefdata. Return true
if its an update-->
<simple>${body} != null and false ==
${bean:CXRefDataCache?method=put}</simple>
........
Thanks
Geoffrey A. Gershaw
===============================================================================
Please access the attached hyperlink for an important electronic communications disclaimer:
http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
===============================================================================
Re: Simple language question
Posted by Christian Schneider <ch...@die-schneider.net>.
How about using setHeader to store the result?
Christian
Am 19.06.2012 14:19, schrieb Gershaw, Geoffrey:
> Thanks for reply Claus,
>
> I see your point. I was trying to avoid writing a nested filter.
>
> <filter>
> <simple>${body} != null</simple>
> <filter>
> <method ref= "CXRefDataCache" method=" put"/>
> <to uri="somewhere"
> </filter>
> <filter>
>
> I guess I am looking for a local variable where I could store the result
> of a predicate on 1 line and use that local variable in the simple
> expression of the filter.
>
> Making sense?
>
> Thanks again
>
>
--
Christian Schneider
http://www.liquid-reality.de
Open Source Architect
Talend Application Integration Division http://www.talend.com
Re: Simple language question
Posted by Willem Jiang <wi...@gmail.com>.
I don't like the two filters either and it will be more easy to define
the expression as a java bean method.
On Tue Jun 19 20:40:27 2012, Claus Ibsen wrote:
> On Tue, Jun 19, 2012 at 2:19 PM, Gershaw, Geoffrey
> <ge...@credit-suisse.com> wrote:
>> Thanks for reply Claus,
>>
>> I see your point. I was trying to avoid writing a nested filter.
>>
>> <filter>
>> <simple>${body} != null</simple>
>> <filter>
>> <method ref= "CXRefDataCache" method=" put"/>
>> <to uri="somewhere"
>> </filter>
>> <filter>
>>
>> I guess I am looking for a local variable where I could store the result
>> of a predicate on 1 line and use that local variable in the simple
>> expression of the filter.
>>
>
> Can you just handle the null body in the CXRefDataCache bean directly,
> and return false if the input is null.
> Then you dont need 2 filters.
>
>
>> Making sense?
>>
>> Thanks again
>>
>>
>> <simple>${body} != null and false ==
>>> ${bean:CXRefDataCache?method=put}</simple>
>> Geoffrey A. Gershaw
>> Credit eTrading Dev - RDO
>> 1 919 994 6412
>>
>> -----Original Message-----
>> From: Claus Ibsen [mailto:claus.ibsen@gmail.com]
>> Sent: Monday, June 18, 2012 11:35 PM
>> To: users@camel.apache.org
>> Subject: Re: Simple language question
>>
>> On Mon, Jun 18, 2012 at 11:49 PM, Gershaw, Geoffrey<
>> geoffrey.gershaw@credit-suisse.com> wrote:
>>
>>> Hello all,
>>>
>>>
>>>
>>> I am using the Spring DSL with the Filter EIP. The below snippet
>> works,
>>> but its confusing. I am trying to include a msg with a non-null body
>>> the outcome of bean:CXRefDataCache?method=put equals false.
>>>
>>>
>>>
>>> Is there a cleaner way?
>>>
>>>
>>>
>> Why is that confusing? You have 2 predicates to test for. And that is
>> what
>> you use in the simple expression.
>> You can put that logic behind a single bean method and give the method a
>> meaningful name
>>
>> <filter>
>> <method ref="myBean" method="someMeaningfulNameHere"/>
>> ...
>> </filter>
>>
>> And there is many other scripting languages you can use, if you think
>> they
>> can provide a less confusing way
>> http://camel.apache.org/languages
>>
>>
>>> <filter>
>>>
>>> <!-- Only process valid (non-null) SecDefs. cache CXRefdata. Return
>> true
>>> if its an update-->
>>>
>>> <simple>${body} != null and false ==
>>> ${bean:CXRefDataCache?method=put}</simple>
>>>
>>> ........
>>>
>>>
>>>
>>> Thanks
>>>
>>>
>>>
>>> Geoffrey A. Gershaw
>>>
>>>
>>>
>>>
>>>
>>>
>> ========================================================================
>> =======
>>> Please access the attached hyperlink for an important electronic
>>> communications disclaimer:
>>> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
>>>
>>>
>> ========================================================================
>> =======
>>>
>>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> FuseSource
>> Email: cibsen@fusesource.com
>> Web: http://fusesource.com
>> Twitter: davsclaus, fusenews
>> Blog: http://davsclaus.com
>> Author of Camel in Action: http://www.manning.com/ibsen
>>
>> ===============================================================================
>> Please access the attached hyperlink for an important electronic communications disclaimer:
>> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
>> ===============================================================================
>>
>
>
>
--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang
Re: Simple language question
Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Jun 19, 2012 at 2:19 PM, Gershaw, Geoffrey
<ge...@credit-suisse.com> wrote:
> Thanks for reply Claus,
>
> I see your point. I was trying to avoid writing a nested filter.
>
> <filter>
> <simple>${body} != null</simple>
> <filter>
> <method ref= "CXRefDataCache" method=" put"/>
> <to uri="somewhere"
> </filter>
> <filter>
>
> I guess I am looking for a local variable where I could store the result
> of a predicate on 1 line and use that local variable in the simple
> expression of the filter.
>
Can you just handle the null body in the CXRefDataCache bean directly,
and return false if the input is null.
Then you dont need 2 filters.
> Making sense?
>
> Thanks again
>
>
> <simple>${body} != null and false ==
>> ${bean:CXRefDataCache?method=put}</simple>
> Geoffrey A. Gershaw
> Credit eTrading Dev - RDO
> 1 919 994 6412
>
> -----Original Message-----
> From: Claus Ibsen [mailto:claus.ibsen@gmail.com]
> Sent: Monday, June 18, 2012 11:35 PM
> To: users@camel.apache.org
> Subject: Re: Simple language question
>
> On Mon, Jun 18, 2012 at 11:49 PM, Gershaw, Geoffrey <
> geoffrey.gershaw@credit-suisse.com> wrote:
>
>> Hello all,
>>
>>
>>
>> I am using the Spring DSL with the Filter EIP. The below snippet
> works,
>> but its confusing. I am trying to include a msg with a non-null body
>> the outcome of bean:CXRefDataCache?method=put equals false.
>>
>>
>>
>> Is there a cleaner way?
>>
>>
>>
> Why is that confusing? You have 2 predicates to test for. And that is
> what
> you use in the simple expression.
> You can put that logic behind a single bean method and give the method a
> meaningful name
>
> <filter>
> <method ref="myBean" method="someMeaningfulNameHere"/>
> ...
> </filter>
>
> And there is many other scripting languages you can use, if you think
> they
> can provide a less confusing way
> http://camel.apache.org/languages
>
>
>> <filter>
>>
>> <!-- Only process valid (non-null) SecDefs. cache CXRefdata. Return
> true
>> if its an update-->
>>
>> <simple>${body} != null and false ==
>> ${bean:CXRefDataCache?method=put}</simple>
>>
>> ........
>>
>>
>>
>> Thanks
>>
>>
>>
>> Geoffrey A. Gershaw
>>
>>
>>
>>
>>
>>
> ========================================================================
> =======
>> Please access the attached hyperlink for an important electronic
>> communications disclaimer:
>> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
>>
>>
> ========================================================================
> =======
>>
>>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>
> ===============================================================================
> Please access the attached hyperlink for an important electronic communications disclaimer:
> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
> ===============================================================================
>
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
RE: Simple language question
Posted by "Gershaw, Geoffrey" <ge...@credit-suisse.com>.
Thanks for reply Claus,
I see your point. I was trying to avoid writing a nested filter.
<filter>
<simple>${body} != null</simple>
<filter>
<method ref= "CXRefDataCache" method=" put"/>
<to uri="somewhere"
</filter>
<filter>
I guess I am looking for a local variable where I could store the result
of a predicate on 1 line and use that local variable in the simple
expression of the filter.
Making sense?
Thanks again
<simple>${body} != null and false ==
> ${bean:CXRefDataCache?method=put}</simple>
Geoffrey A. Gershaw
Credit eTrading Dev - RDO
1 919 994 6412
-----Original Message-----
From: Claus Ibsen [mailto:claus.ibsen@gmail.com]
Sent: Monday, June 18, 2012 11:35 PM
To: users@camel.apache.org
Subject: Re: Simple language question
On Mon, Jun 18, 2012 at 11:49 PM, Gershaw, Geoffrey <
geoffrey.gershaw@credit-suisse.com> wrote:
> Hello all,
>
>
>
> I am using the Spring DSL with the Filter EIP. The below snippet
works,
> but its confusing. I am trying to include a msg with a non-null body
> the outcome of bean:CXRefDataCache?method=put equals false.
>
>
>
> Is there a cleaner way?
>
>
>
Why is that confusing? You have 2 predicates to test for. And that is
what
you use in the simple expression.
You can put that logic behind a single bean method and give the method a
meaningful name
<filter>
<method ref="myBean" method="someMeaningfulNameHere"/>
...
</filter>
And there is many other scripting languages you can use, if you think
they
can provide a less confusing way
http://camel.apache.org/languages
> <filter>
>
> <!-- Only process valid (non-null) SecDefs. cache CXRefdata. Return
true
> if its an update-->
>
> <simple>${body} != null and false ==
> ${bean:CXRefDataCache?method=put}</simple>
>
> ........
>
>
>
> Thanks
>
>
>
> Geoffrey A. Gershaw
>
>
>
>
>
>
========================================================================
=======
> Please access the attached hyperlink for an important electronic
> communications disclaimer:
> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
>
>
========================================================================
=======
>
>
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
===============================================================================
Please access the attached hyperlink for an important electronic communications disclaimer:
http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
===============================================================================
Re: Simple language question
Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Jun 18, 2012 at 11:49 PM, Gershaw, Geoffrey <
geoffrey.gershaw@credit-suisse.com> wrote:
> Hello all,
>
>
>
> I am using the Spring DSL with the Filter EIP. The below snippet works,
> but its confusing. I am trying to include a msg with a non-null body
> the outcome of bean:CXRefDataCache?method=put equals false.
>
>
>
> Is there a cleaner way?
>
>
>
Why is that confusing? You have 2 predicates to test for. And that is what
you use in the simple expression.
You can put that logic behind a single bean method and give the method a
meaningful name
<filter>
<method ref="myBean" method="someMeaningfulNameHere"/>
...
</filter>
And there is many other scripting languages you can use, if you think they
can provide a less confusing way
http://camel.apache.org/languages
> <filter>
>
> <!-- Only process valid (non-null) SecDefs. cache CXRefdata. Return true
> if its an update-->
>
> <simple>${body} != null and false ==
> ${bean:CXRefDataCache?method=put}</simple>
>
> ........
>
>
>
> Thanks
>
>
>
> Geoffrey A. Gershaw
>
>
>
>
>
> ===============================================================================
> Please access the attached hyperlink for an important electronic
> communications disclaimer:
> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
>
> ===============================================================================
>
>
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen