You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ruangerm <ru...@gmail.com> on 2011/08/04 20:10:19 UTC
How print header without square brackets
Hi all,
I need to send a text message response to a JMS queuethat contains an
existing header (file_header) value (in this case something like B,S,3,10)
in the outgoing body . So the response needs to look something like this:
B,S,3,10
2,2,3,4,List 2,BList2
2,2,3,4,List 3,BList3
...
I am using the following to construct the response:
transform(simple("${header.file_header}\n${body}")).to("jms:....
However, the output is being created like this on my JMS queue
[B,S,3,10]
2,2,3,4,List 2,BList2
2,2,3,4,List 3,BList3
Is it possible to have the brackets removed without having to revert to some
kind of string manipulation in Java in a process/bean?
Any help is appreciated greatly.
Regards
Ruan
--
View this message in context: http://camel.465427.n5.nabble.com/How-print-header-without-square-brackets-tp4667349p4667349.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How print header without square brackets
Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Aug 4, 2011 at 8:31 PM, Jon Anstey <ja...@gmail.com> wrote:
> The brackets are there I'm guessing because your file_header header is some
> sort of Java collection? You can most likely do an inline trim or substring
> using another scripting language instead of "simple" - Groovy for example
> http://camel.apache.org/groovy.html. But it would be just as easy to create
> a simple bean or processor for this IMO.
>
If the file_header is a List/Array and you know that it should just
grab the 1st entry of the list/array, you can index this with the
simple language:
transform(simple("${header.file_header[0]}\n${body}"))
See more details at: (simple OGNL support)
http://camel.apache.org/simple
Alternatively then strong scripting languages such as Groovy,
JavaScript, etc could be an alternative
http://camel.apache.org/languages.html
> Cheers,
> Jon
>
> On Thu, Aug 4, 2011 at 3:40 PM, ruangerm <ru...@gmail.com> wrote:
>
>> Hi all,
>>
>> I need to send a text message response to a JMS queuethat contains an
>> existing header (file_header) value (in this case something like B,S,3,10)
>> in the outgoing body . So the response needs to look something like this:
>>
>> B,S,3,10
>> 2,2,3,4,List 2,BList2
>> 2,2,3,4,List 3,BList3
>> ...
>>
>> I am using the following to construct the response:
>> transform(simple("${header.file_header}\n${body}")).to("jms:....
>> However, the output is being created like this on my JMS queue
>>
>> [B,S,3,10]
>> 2,2,3,4,List 2,BList2
>> 2,2,3,4,List 3,BList3
>>
>> Is it possible to have the brackets removed without having to revert to
>> some
>> kind of string manipulation in Java in a process/bean?
>>
>> Any help is appreciated greatly.
>> Regards
>> Ruan
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/How-print-header-without-square-brackets-tp4667349p4667349.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>
>
>
> --
> Cheers,
> Jon
> ---------------
> FuseSource
> Email: jon@fusesource.com
> Web: fusesource.com
> Twitter: jon_anstey
> Blog: http://janstey.blogspot.com
> Author of Camel in Action: http://manning.com/ibsen
>
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Re: How print header without square brackets
Posted by Jon Anstey <ja...@gmail.com>.
The brackets are there I'm guessing because your file_header header is some
sort of Java collection? You can most likely do an inline trim or substring
using another scripting language instead of "simple" - Groovy for example
http://camel.apache.org/groovy.html. But it would be just as easy to create
a simple bean or processor for this IMO.
Cheers,
Jon
On Thu, Aug 4, 2011 at 3:40 PM, ruangerm <ru...@gmail.com> wrote:
> Hi all,
>
> I need to send a text message response to a JMS queuethat contains an
> existing header (file_header) value (in this case something like B,S,3,10)
> in the outgoing body . So the response needs to look something like this:
>
> B,S,3,10
> 2,2,3,4,List 2,BList2
> 2,2,3,4,List 3,BList3
> ...
>
> I am using the following to construct the response:
> transform(simple("${header.file_header}\n${body}")).to("jms:....
> However, the output is being created like this on my JMS queue
>
> [B,S,3,10]
> 2,2,3,4,List 2,BList2
> 2,2,3,4,List 3,BList3
>
> Is it possible to have the brackets removed without having to revert to
> some
> kind of string manipulation in Java in a process/bean?
>
> Any help is appreciated greatly.
> Regards
> Ruan
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/How-print-header-without-square-brackets-tp4667349p4667349.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Cheers,
Jon
---------------
FuseSource
Email: jon@fusesource.com
Web: fusesource.com
Twitter: jon_anstey
Blog: http://janstey.blogspot.com
Author of Camel in Action: http://manning.com/ibsen