You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Tom Ellis <te...@gmail.com> on 2013/09/20 11:08:15 UTC

tokenize + group + aggregator strategy?

Hi

Is it possible to do something like this:

int myGroupSize = 100;
.split(body().tokenize("\n", myGroupSize), new myAggStrategy()) ?

The above doesn't work because the tokenize methods on the
ValueBuilder don't take groups. The following compiles but is it the
best way/can someone see if it obviously won't work?

TokenizeLanguage language = new TokenizeLanguage();
language.setToken("\n");
language.setGroup(myGroupSize);
language.setIncludeTokens(true);
.split(new ValueBuilder(language.createExpression(null)), new myAggStrategy())..

Cheers,

Tom

Re: tokenize + group + aggregator strategy?

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Do like this
.split().tokenize("\n", 100).aggregationStrategy(myStrategy)

On Fri, Sep 20, 2013 at 11:08 AM, Tom Ellis <te...@gmail.com> wrote:
> Hi
>
> Is it possible to do something like this:
>
> int myGroupSize = 100;
> .split(body().tokenize("\n", myGroupSize), new myAggStrategy()) ?
>
> The above doesn't work because the tokenize methods on the
> ValueBuilder don't take groups. The following compiles but is it the
> best way/can someone see if it obviously won't work?
>
> TokenizeLanguage language = new TokenizeLanguage();
> language.setToken("\n");
> language.setGroup(myGroupSize);
> language.setIncludeTokens(true);
> .split(new ValueBuilder(language.createExpression(null)), new myAggStrategy())..
>
> Cheers,
>
> Tom



-- 
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

Re: tokenize + group + aggregator strategy?

Posted by Aida <ai...@gmail.com>.
Could you put an example of what have you tested? and which is the next step
inside and after the splitter



--
View this message in context: http://camel.465427.n5.nabble.com/tokenize-group-aggregator-strategy-tp5739864p5739869.html
Sent from the Camel - Users mailing list archive at Nabble.com.