camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: Message body lost in email when filtering
Date Fri, 11 Nov 2011 09:53:38 GMT

Seems like a streaming issue. The filter needs to acces the message
body which is stream based, and so not re-readable.

See details here

A good alternative is to convert the message body to a String which
ensures the message gets read into memory.
This can be done with

<convertBodyTo type="String"/>

Right after the <to uri="http:xxx"/>, as its the http endpoint which
returns a stream result

On Wed, Nov 9, 2011 at 6:40 PM, mlafleur <> wrote:
> I am using camel 2.7.4
> When I do a route like:
> <route>
>  <from uri=&quot;timer://...
>  &lt;to uri=&quot;http://...
>  &lt;to uri=&quot;smtp://...
> &lt;/route>
> This works fine and the email contains the html from the specified http call
> in it's message body.
> However, when I try to only send the email based on a filter (or choice),
> the filter works as to whether the email is sent but the email no longer has
> the content from the http call in it's message body.
> <route>
>  <from uri=&quot;timer://...
>  &lt;to uri=&quot;http://...
>  &lt;filter>
>    <language
> language="beanshell">!request.getBody(String.class).contains("SOME_VALUE")</language>
>    <to uri=&quot;smtp://...
>  &lt;/filter>
> </route>
> How can I get this to work?
> --
> View this message in context:
> Sent from the Camel - Users mailing list archive at

Claus Ibsen
Twitter: davsclaus, fusenews
Author of Camel in Action:

View raw message