FAQ
I have recently upgraded Camel to version 2.11.0. In my file transfer
services I have used a predicate together with interceptors to avoid
transferring empty files but instead move them into a subfolder called
"skipped". However, this has stopped working. My predicate looks like this:

*Predicate emptyFile =
PredicateBuilder.toPredicate(SimpleLanguage.simple("${file:length} == 0"));
*

I'm not exactly sure in what version this functionality broke but I'm sure
it worked in version 2.7.1.

Is there a better way to do this in Camel 2.11.0?

/Bengt

Search Discussions

  • Claus Ibsen at Aug 14, 2013 at 2:29 pm
    See also the readLockMinLength option
    On Wed, Aug 14, 2013 at 4:26 PM, Bengt Rodehav wrote:
    I have recently upgraded Camel to version 2.11.0. In my file transfer
    services I have used a predicate together with interceptors to avoid
    transferring empty files but instead move them into a subfolder called
    "skipped". However, this has stopped working. My predicate looks like this:

    *Predicate emptyFile =
    PredicateBuilder.toPredicate(SimpleLanguage.simple("${file:length} == 0"));
    *

    I'm not exactly sure in what version this functionality broke but I'm sure
    it worked in version 2.7.1.

    Is there a better way to do this in Camel 2.11.0?

    /Bengt


    --
    Claus Ibsen
    -----------------
    Red Hat, Inc.
    Email: cibsen@redhat.com
    Twitter: davsclaus
    Blog: http://davsclaus.com
    Author of Camel in Action: http://www.manning.com/ibsen
  • Bengt Rodehav at Aug 14, 2013 at 2:40 pm
    Thanks for the tip. It would probably be good enough although I also want
    to move the empty files to a dedicated directory to clearly show what took
    place.

    Do you know f the syntax for checking the file length has changed in Simple
    language (or rather File language)? Looking at the documentation I can't
    see that I'm doing anything wrong.

    /Bengt


    2013/8/14 Claus Ibsen <claus.ibsen@gmail.com>
    See also the readLockMinLength option
    On Wed, Aug 14, 2013 at 4:26 PM, Bengt Rodehav wrote:
    I have recently upgraded Camel to version 2.11.0. In my file transfer
    services I have used a predicate together with interceptors to avoid
    transferring empty files but instead move them into a subfolder called
    "skipped". However, this has stopped working. My predicate looks like this:
    *Predicate emptyFile =
    PredicateBuilder.toPredicate(SimpleLanguage.simple("${file:length} == 0"));
    *

    I'm not exactly sure in what version this functionality broke but I'm sure
    it worked in version 2.7.1.

    Is there a better way to do this in Camel 2.11.0?

    /Bengt


    --
    Claus Ibsen
    -----------------
    Red Hat, Inc.
    Email: cibsen@redhat.com
    Twitter: davsclaus
    Blog: http://davsclaus.com
    Author of Camel in Action: http://www.manning.com/ibsen
  • Bengt Rodehav at Aug 15, 2013 at 7:50 am
    My original code that has been working for 2-3 years looks like this:

    *Predicate emptyFile =
    PredicateBuilder.toPredicate(SimpleLanguage.simple("${file:length} == 0"));

    interceptFrom().when(emptyFile).setHeader("recipient").simple("file://${file:parent}/skipped/${date:now:yyyyMMdd}").recipientList(header("recipient")).stop();
    *

    For some reason, when using Camel 2.11.0, the above code causes all files
    to be skipped (even the non-empty ones). I have found another way of doing
    this that works with Camel 2.11.0. It looks as follows:

    *
    interceptFrom().when(header("CamelFileLength").isEqualTo(0)).setHeader("recipient").simple("file://${file:parent}/skipped/${date:now:yyyyMMdd}").recipientList(header("recipient")).stop();
    *

    I'm not sure what is happening. Since I have a workaround I'm OK but it
    seems like the behaviour of the SimpleLanguage has changed somehow. Could
    be a bug or at least something worth documenting.

    Any thoughts?

    /Bengt





    2013/8/14 Bengt Rodehav <bengt@rodehav.com>
    Thanks for the tip. It would probably be good enough although I also want
    to move the empty files to a dedicated directory to clearly show what took
    place.

    Do you know f the syntax for checking the file length has changed in
    Simple language (or rather File language)? Looking at the documentation I
    can't see that I'm doing anything wrong.

    /Bengt


    2013/8/14 Claus Ibsen <claus.ibsen@gmail.com>
    See also the readLockMinLength option
    On Wed, Aug 14, 2013 at 4:26 PM, Bengt Rodehav wrote:
    I have recently upgraded Camel to version 2.11.0. In my file transfer
    services I have used a predicate together with interceptors to avoid
    transferring empty files but instead move them into a subfolder called
    "skipped". However, this has stopped working. My predicate looks like this:
    *Predicate emptyFile =
    PredicateBuilder.toPredicate(SimpleLanguage.simple("${file:length} == 0"));
    *

    I'm not exactly sure in what version this functionality broke but I'm sure
    it worked in version 2.7.1.

    Is there a better way to do this in Camel 2.11.0?

    /Bengt


    --
    Claus Ibsen
    -----------------
    Red Hat, Inc.
    Email: cibsen@redhat.com
    Twitter: davsclaus
    Blog: http://davsclaus.com
    Author of Camel in Action: http://www.manning.com/ibsen
  • Claus Ibsen at Aug 15, 2013 at 9:53 am
    Hi

    This is because you use the simple language "wrong" as you create an
    expression, and NOT a predicate.

    I have logged a ticket to improve on this, so you have static methods
    to easily create a predicate
    https://issues.apache.org/jira/browse/CAMEL-6639
    On Thu, Aug 15, 2013 at 9:49 AM, Bengt Rodehav wrote:
    My original code that has been working for 2-3 years looks like this:

    *Predicate emptyFile =
    PredicateBuilder.toPredicate(SimpleLanguage.simple("${file:length} == 0"));

    interceptFrom().when(emptyFile).setHeader("recipient").simple("file://${file:parent}/skipped/${date:now:yyyyMMdd}").recipientList(header("recipient")).stop();
    *

    For some reason, when using Camel 2.11.0, the above code causes all files
    to be skipped (even the non-empty ones). I have found another way of doing
    this that works with Camel 2.11.0. It looks as follows:

    *
    interceptFrom().when(header("CamelFileLength").isEqualTo(0)).setHeader("recipient").simple("file://${file:parent}/skipped/${date:now:yyyyMMdd}").recipientList(header("recipient")).stop();
    *

    I'm not sure what is happening. Since I have a workaround I'm OK but it
    seems like the behaviour of the SimpleLanguage has changed somehow. Could
    be a bug or at least something worth documenting.

    Any thoughts?

    /Bengt





    2013/8/14 Bengt Rodehav <bengt@rodehav.com>
    Thanks for the tip. It would probably be good enough although I also want
    to move the empty files to a dedicated directory to clearly show what took
    place.

    Do you know f the syntax for checking the file length has changed in
    Simple language (or rather File language)? Looking at the documentation I
    can't see that I'm doing anything wrong.

    /Bengt


    2013/8/14 Claus Ibsen <claus.ibsen@gmail.com>
    See also the readLockMinLength option
    On Wed, Aug 14, 2013 at 4:26 PM, Bengt Rodehav wrote:
    I have recently upgraded Camel to version 2.11.0. In my file transfer
    services I have used a predicate together with interceptors to avoid
    transferring empty files but instead move them into a subfolder called
    "skipped". However, this has stopped working. My predicate looks like this:
    *Predicate emptyFile =
    PredicateBuilder.toPredicate(SimpleLanguage.simple("${file:length} == 0"));
    *

    I'm not exactly sure in what version this functionality broke but I'm sure
    it worked in version 2.7.1.

    Is there a better way to do this in Camel 2.11.0?

    /Bengt


    --
    Claus Ibsen
    -----------------
    Red Hat, Inc.
    Email: cibsen@redhat.com
    Twitter: davsclaus
    Blog: http://davsclaus.com
    Author of Camel in Action: http://www.manning.com/ibsen


    --
    Claus Ibsen
    -----------------
    Red Hat, Inc.
    Email: cibsen@redhat.com
    Twitter: davsclaus
    Blog: http://davsclaus.com
    Author of Camel in Action: http://www.manning.com/ibsen
  • Bengt Rodehav at Aug 15, 2013 at 11:43 am
    Thanks Claus.

    I do believe that the "PredicateBuilder.toPredicate" method I use does take
    an expression as a parameter and returns a Predicate. Which method should I
    have used?

    /Bengt




    2013/8/15 Claus Ibsen <claus.ibsen@gmail.com>
    Hi

    This is because you use the simple language "wrong" as you create an
    expression, and NOT a predicate.

    I have logged a ticket to improve on this, so you have static methods
    to easily create a predicate
    https://issues.apache.org/jira/browse/CAMEL-6639
    On Thu, Aug 15, 2013 at 9:49 AM, Bengt Rodehav wrote:
    My original code that has been working for 2-3 years looks like this:

    *Predicate emptyFile =
    PredicateBuilder.toPredicate(SimpleLanguage.simple("${file:length} ==
    0"));
    interceptFrom().when(emptyFile).setHeader("recipient").simple("file://${file:parent}/skipped/${date:now:yyyyMMdd}").recipientList(header("recipient")).stop();
    *

    For some reason, when using Camel 2.11.0, the above code causes all files
    to be skipped (even the non-empty ones). I have found another way of doing
    this that works with Camel 2.11.0. It looks as follows:

    *
    interceptFrom().when(header("CamelFileLength").isEqualTo(0)).setHeader("recipient").simple("file://${file:parent}/skipped/${date:now:yyyyMMdd}").recipientList(header("recipient")).stop();
    *

    I'm not sure what is happening. Since I have a workaround I'm OK but it
    seems like the behaviour of the SimpleLanguage has changed somehow. Could
    be a bug or at least something worth documenting.

    Any thoughts?

    /Bengt





    2013/8/14 Bengt Rodehav <bengt@rodehav.com>
    Thanks for the tip. It would probably be good enough although I also
    want
    to move the empty files to a dedicated directory to clearly show what
    took
    place.

    Do you know f the syntax for checking the file length has changed in
    Simple language (or rather File language)? Looking at the documentation
    I
    can't see that I'm doing anything wrong.

    /Bengt


    2013/8/14 Claus Ibsen <claus.ibsen@gmail.com>
    See also the readLockMinLength option
    On Wed, Aug 14, 2013 at 4:26 PM, Bengt Rodehav wrote:
    I have recently upgraded Camel to version 2.11.0. In my file transfer
    services I have used a predicate together with interceptors to avoid
    transferring empty files but instead move them into a subfolder
    called
    "skipped". However, this has stopped working. My predicate looks like this:
    *Predicate emptyFile =
    PredicateBuilder.toPredicate(SimpleLanguage.simple("${file:length} == 0"));
    *

    I'm not exactly sure in what version this functionality broke but I'm sure
    it worked in version 2.7.1.

    Is there a better way to do this in Camel 2.11.0?

    /Bengt


    --
    Claus Ibsen
    -----------------
    Red Hat, Inc.
    Email: cibsen@redhat.com
    Twitter: davsclaus
    Blog: http://davsclaus.com
    Author of Camel in Action: http://www.manning.com/ibsen


    --
    Claus Ibsen
    -----------------
    Red Hat, Inc.
    Email: cibsen@redhat.com
    Twitter: davsclaus
    Blog: http://davsclaus.com
    Author of Camel in Action: http://www.manning.com/ibsen
  • Claus Ibsen at Aug 15, 2013 at 12:31 pm
    There should be non static methods on simple language to create a predicate.
    On Thu, Aug 15, 2013 at 1:43 PM, Bengt Rodehav wrote:
    Thanks Claus.

    I do believe that the "PredicateBuilder.toPredicate" method I use does take
    an expression as a parameter and returns a Predicate. Which method should I
    have used?

    /Bengt




    2013/8/15 Claus Ibsen <claus.ibsen@gmail.com>
    Hi

    This is because you use the simple language "wrong" as you create an
    expression, and NOT a predicate.

    I have logged a ticket to improve on this, so you have static methods
    to easily create a predicate
    https://issues.apache.org/jira/browse/CAMEL-6639
    On Thu, Aug 15, 2013 at 9:49 AM, Bengt Rodehav wrote:
    My original code that has been working for 2-3 years looks like this:

    *Predicate emptyFile =
    PredicateBuilder.toPredicate(SimpleLanguage.simple("${file:length} ==
    0"));
    interceptFrom().when(emptyFile).setHeader("recipient").simple("file://${file:parent}/skipped/${date:now:yyyyMMdd}").recipientList(header("recipient")).stop();
    *

    For some reason, when using Camel 2.11.0, the above code causes all files
    to be skipped (even the non-empty ones). I have found another way of doing
    this that works with Camel 2.11.0. It looks as follows:

    *
    interceptFrom().when(header("CamelFileLength").isEqualTo(0)).setHeader("recipient").simple("file://${file:parent}/skipped/${date:now:yyyyMMdd}").recipientList(header("recipient")).stop();
    *

    I'm not sure what is happening. Since I have a workaround I'm OK but it
    seems like the behaviour of the SimpleLanguage has changed somehow. Could
    be a bug or at least something worth documenting.

    Any thoughts?

    /Bengt





    2013/8/14 Bengt Rodehav <bengt@rodehav.com>
    Thanks for the tip. It would probably be good enough although I also
    want
    to move the empty files to a dedicated directory to clearly show what
    took
    place.

    Do you know f the syntax for checking the file length has changed in
    Simple language (or rather File language)? Looking at the documentation
    I
    can't see that I'm doing anything wrong.

    /Bengt


    2013/8/14 Claus Ibsen <claus.ibsen@gmail.com>
    See also the readLockMinLength option

    On Wed, Aug 14, 2013 at 4:26 PM, Bengt Rodehav <bengt@rodehav.com>
    wrote:
    I have recently upgraded Camel to version 2.11.0. In my file transfer
    services I have used a predicate together with interceptors to avoid
    transferring empty files but instead move them into a subfolder
    called
    "skipped". However, this has stopped working. My predicate looks like this:
    *Predicate emptyFile =
    PredicateBuilder.toPredicate(SimpleLanguage.simple("${file:length} == 0"));
    *

    I'm not exactly sure in what version this functionality broke but I'm sure
    it worked in version 2.7.1.

    Is there a better way to do this in Camel 2.11.0?

    /Bengt


    --
    Claus Ibsen
    -----------------
    Red Hat, Inc.
    Email: cibsen@redhat.com
    Twitter: davsclaus
    Blog: http://davsclaus.com
    Author of Camel in Action: http://www.manning.com/ibsen


    --
    Claus Ibsen
    -----------------
    Red Hat, Inc.
    Email: cibsen@redhat.com
    Twitter: davsclaus
    Blog: http://davsclaus.com
    Author of Camel in Action: http://www.manning.com/ibsen


    --
    Claus Ibsen
    -----------------
    Red Hat, Inc.
    Email: cibsen@redhat.com
    Twitter: davsclaus
    Blog: http://davsclaus.com
    Author of Camel in Action: http://www.manning.com/ibsen
  • Bengt Rodehav at Aug 15, 2013 at 1:51 pm
    OK - thanks.

    /Bengt


    2013/8/15 Claus Ibsen <claus.ibsen@gmail.com>
    There should be non static methods on simple language to create a
    predicate.
    On Thu, Aug 15, 2013 at 1:43 PM, Bengt Rodehav wrote:
    Thanks Claus.

    I do believe that the "PredicateBuilder.toPredicate" method I use does take
    an expression as a parameter and returns a Predicate. Which method should I
    have used?

    /Bengt




    2013/8/15 Claus Ibsen <claus.ibsen@gmail.com>
    Hi

    This is because you use the simple language "wrong" as you create an
    expression, and NOT a predicate.

    I have logged a ticket to improve on this, so you have static methods
    to easily create a predicate
    https://issues.apache.org/jira/browse/CAMEL-6639
    On Thu, Aug 15, 2013 at 9:49 AM, Bengt Rodehav wrote:
    My original code that has been working for 2-3 years looks like this:

    *Predicate emptyFile =
    PredicateBuilder.toPredicate(SimpleLanguage.simple("${file:length} ==
    0"));
    interceptFrom().when(emptyFile).setHeader("recipient").simple("file://${file:parent}/skipped/${date:now:yyyyMMdd}").recipientList(header("recipient")).stop();
    *

    For some reason, when using Camel 2.11.0, the above code causes all
    files
    to be skipped (even the non-empty ones). I have found another way of doing
    this that works with Camel 2.11.0. It looks as follows:

    *
    interceptFrom().when(header("CamelFileLength").isEqualTo(0)).setHeader("recipient").simple("file://${file:parent}/skipped/${date:now:yyyyMMdd}").recipientList(header("recipient")).stop();
    *

    I'm not sure what is happening. Since I have a workaround I'm OK but
    it
    seems like the behaviour of the SimpleLanguage has changed somehow.
    Could
    be a bug or at least something worth documenting.

    Any thoughts?

    /Bengt





    2013/8/14 Bengt Rodehav <bengt@rodehav.com>
    Thanks for the tip. It would probably be good enough although I also
    want
    to move the empty files to a dedicated directory to clearly show what
    took
    place.

    Do you know f the syntax for checking the file length has changed in
    Simple language (or rather File language)? Looking at the
    documentation
    I
    can't see that I'm doing anything wrong.

    /Bengt


    2013/8/14 Claus Ibsen <claus.ibsen@gmail.com>
    See also the readLockMinLength option

    On Wed, Aug 14, 2013 at 4:26 PM, Bengt Rodehav <bengt@rodehav.com>
    wrote:
    I have recently upgraded Camel to version 2.11.0. In my file
    transfer
    services I have used a predicate together with interceptors to
    avoid
    transferring empty files but instead move them into a subfolder
    called
    "skipped". However, this has stopped working. My predicate looks
    like
    this:
    *Predicate emptyFile =
    PredicateBuilder.toPredicate(SimpleLanguage.simple("${file:length} ==
    0"));
    *

    I'm not exactly sure in what version this functionality broke but
    I'm
    sure
    it worked in version 2.7.1.

    Is there a better way to do this in Camel 2.11.0?

    /Bengt


    --
    Claus Ibsen
    -----------------
    Red Hat, Inc.
    Email: cibsen@redhat.com
    Twitter: davsclaus
    Blog: http://davsclaus.com
    Author of Camel in Action: http://www.manning.com/ibsen


    --
    Claus Ibsen
    -----------------
    Red Hat, Inc.
    Email: cibsen@redhat.com
    Twitter: davsclaus
    Blog: http://davsclaus.com
    Author of Camel in Action: http://www.manning.com/ibsen


    --
    Claus Ibsen
    -----------------
    Red Hat, Inc.
    Email: cibsen@redhat.com
    Twitter: davsclaus
    Blog: http://davsclaus.com
    Author of Camel in Action: http://www.manning.com/ibsen

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupusers @
categoriescamel
postedAug 14, '13 at 2:26p
activeAug 15, '13 at 1:51p
posts8
users2
websitecamel.apache.org

2 users in discussion

Bengt Rodehav: 5 posts Claus Ibsen: 3 posts

People

Translate

site design / logo © 2022 Grokbase