You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Robert James Liguori <gl...@yahoo.com> on 2013/10/28 14:53:17 UTC
Including newlines towards stream/file endpoint
How would one add a newline for each message being sent through this route?
<route >
<from uri="activemq:topic:TOPIC1"/>
<to uri="stream:file?fileName=/tmp/data1.txt"/>
</route>
Thanks,
Robert
Re: Including newlines towards stream/file endpoint
Posted by Henryk Konsek <he...@gmail.com>.
Hi Robert,
> How would one add a newline for each message being sent through this route?
Keep in mind that newlines are automatically appended to the string
messages. Appropriate excerpt from our documentation [1]:
// Send String payload to the standard output.
// Message will be followed by the newline.
template.sendBody("direct:in", "Hello Text World");
// Send byte[] payload to the standard output.
// No newline will be added after the message.
template.sendBody("direct:in", "Hello Bytes World".getBytes());
In your case you seems to receive non-String messages from the topic
(which are automatically converted to the byte[] messages by the
producer). What about converting [2] them to the Strings then before
they hit the producer endpoint? Strings will be automatically appended
by the newline.
Cheers.
[1] http://camel.apache.org/stream.html
[2] http://camel.apache.org/convertbodyto.html
--
Henryk Konsek
http://henryk-konsek.blogspot.com
Re: Including newlines towards stream/file endpoint
Posted by Claus Ibsen <cl...@gmail.com>.
Use the content enricher eip and append the new line to the message
before sending to the stream endpoint.
On Mon, Oct 28, 2013 at 2:53 PM, Robert James Liguori
<gl...@yahoo.com> wrote:
> How would one add a newline for each message being sent through this route?
>
>
> <route >
> <from uri="activemq:topic:TOPIC1"/>
> <to uri="stream:file?fileName=/tmp/data1.txt"/>
> </route>
>
> Thanks,
> Robert
--
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