Grokbase Groups Camel users June 2012
FAQ
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
===============================================================================

Search Discussions

  • Claus Ibsen at Jun 19, 2012 at 3:35 am

    On Mon, Jun 18, 2012 at 11:49 PM, Gershaw, Geoffrey 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
  • Gershaw, Geoffrey at Jun 19, 2012 at 12:20 pm
    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
    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 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
    ===============================================================================
  • Christian Schneider at Jun 19, 2012 at 12:29 pm
    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
  • Claus Ibsen at Jun 19, 2012 at 12:41 pm

    On Tue, Jun 19, 2012 at 2:19 PM, Gershaw, Geoffrey 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
    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
  • Willem Jiang at Jun 20, 2012 at 3:01 am
    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
    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
    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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupusers @
categoriescamel
postedJun 18, '12 at 9:49p
activeJun 20, '12 at 3:01a
posts6
users4
websitecamel.apache.org

People

Translate

site design / logo © 2021 Grokbase