You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Mikhail Lukyanov <lu...@gmail.com> on 2020/06/28 09:29:33 UTC

Split header with tokenize with Spring DSL

It says
https://camel.apache.org/components/latest/eips/split-eip.html#_using_tokenizer_from_spring_xml_extensions
 that
you can use the tokenizer expression in the Spring DSL to split bodies or
headers using a token.

How can I split header with tokenize (for example I have in the header with
name 'split' string "A@B@C" and I need split it by token "@")?
I thought I could do it as follows




*<split>      <header>split</header>      <tokenize token="@"/>      <to
uri="mock:result"/> *
*</split>*

But when I save this code, I get an error

java.lang.RuntimeException: validation error: cvc-complex-type.2.4.a:
Invalid content was found starting with element 'tokenize'. One of '{"
http://camel.apache.org/schema/spring":aop, "
http://camel.apache.org/schema/spring":aggregate, "
http://camel.apache.org/schema

-- 
*With best regards, Lukyanov Mikhail*
*Tel: **+7-909-69-71-547*

Re: Split header with tokenize with Spring DSL

Posted by Mikhail Lukyanov <lu...@gmail.com>.
I found a solution, the tokenize language has an option 'headerName' (Name
of header to tokenize instead of using the message body)
https://camel.apache.org/components/latest/languages/tokenize-language.html.
This works




*<split>  <tokenize headerName="split" token="@"/>  <to
uri="mock:result"/></split>*

вс, 28 июн. 2020 г. в 12:29, Mikhail Lukyanov <lu...@gmail.com>:

> It says
> https://camel.apache.org/components/latest/eips/split-eip.html#_using_tokenizer_from_spring_xml_extensions  that
> you can use the tokenizer expression in the Spring DSL to split bodies or
> headers using a token.
>
> How can I split header with tokenize (for example I have in the header
> with name 'split' string "A@B@C" and I need split it by token "@")?
> I thought I could do it as follows
>
>
>
>
> *<split>      <header>split</header>      <tokenize token="@"/>      <to
> uri="mock:result"/> *
> *</split>*
>
> But when I save this code, I get an error
>
> java.lang.RuntimeException: validation error: cvc-complex-type.2.4.a:
> Invalid content was found starting with element 'tokenize'. One of '{"
> http://camel.apache.org/schema/spring":aop, "
> http://camel.apache.org/schema/spring":aggregate, "
> http://camel.apache.org/schema
>
> --
> *With best regards, Lukyanov Mikhail*
> *Tel: **+7-909-69-71-547*
>


-- 
*With best regards, Lukyanov Mikhail*
*Tel: **+7-909-69-71-547​*