Using Exchange.SPLIT_INDEX

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Using Exchange.SPLIT_INDEX

jpcook01
Hello,

I have recently upgraded to Camel 2 which has a different implementation of splitting messages or seems to.
http://camel.apache.org/splitter.html

Specifically the CamelSplitIndex header. In my routebuilder I have used split and supplied my own SplitExpression class. This all works nicely and the log statements confirm this. I want to use the Exchange.SPLIT_INDEX and set that on my own component. But it is returning the string literal camelSplitIndex which is the default value defined in Exchange.java. I'm not sure If I have to set this header myself? But this all worked in camel 1.5 using the Splitter.SPLIT_COUNTER?

                        .split(new BatchSplitExpression("/locations/location", 10))
                        .setBody(GroovyLanguage.groovy("'<?xml version=\"1.0\" encoding=\"UTF-8\"?><locations>'+request.body+'</locations>'"))
                        .to("log:AfterSplit")
                        .process(XsltBuilder.xslt(new File("xslt\\observations\\ceefax\\daily_observations.ceefax.xslt")))
                        .to("log:AfterTransform")
                        .process(new PlasmaPaginatorProcessor(18, false))            
                        .setHeader(PlasmaComponent.PLASMA_PAGE_NO, GroovyLanguage.groovy("'"+Exchange.SPLIT_INDEX+"'"))

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Using Exchange.SPLIT_INDEX

jpcook01
Sorry about this one. Its easily resolved:
.setHeader(PlasmaComponent.PLASMA_PAGE_NO, GroovyLanguage.groovy("request.headers['"+Exchange.SPLIT_INDEX+"']"))
jpcook wrote
Hello,

I have recently upgraded to Camel 2 which has a different implementation of splitting messages or seems to.
http://camel.apache.org/splitter.html

Specifically the CamelSplitIndex header. In my routebuilder I have used split and supplied my own SplitExpression class. This all works nicely and the log statements confirm this. I want to use the Exchange.SPLIT_INDEX and set that on my own component. But it is returning the string literal camelSplitIndex which is the default value defined in Exchange.java. I'm not sure If I have to set this header myself? But this all worked in camel 1.5 using the Splitter.SPLIT_COUNTER?

                        .split(new BatchSplitExpression("/locations/location", 10))
                        .setBody(GroovyLanguage.groovy("'<?xml version=\"1.0\" encoding=\"UTF-8\"?><locations>'+request.body+'</locations>'"))
                        .to("log:AfterSplit")
                        .process(XsltBuilder.xslt(new File("xslt\\observations\\ceefax\\daily_observations.ceefax.xslt")))
                        .to("log:AfterTransform")
                        .process(new PlasmaPaginatorProcessor(18, false))            
                        .setHeader(PlasmaComponent.PLASMA_PAGE_NO, GroovyLanguage.groovy("'"+Exchange.SPLIT_INDEX+"'"))

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Using Exchange.SPLIT_INDEX

Claus Ibsen-2
In reply to this post by jpcook01
Hi

You can set a header in Camel in the DSL without using Groovy language
>                        .setHeader(PlasmaComponent.PLASMA_PAGE_NO,
> GroovyLanguage.groovy("'"+Exchange.SPLIT_INDEX+"'"))

Could be

.setHeader(PlasmaComponent.PLASMA_PAGE_NO, header(Exchange.SPLIT_INDEX))


On Tue, May 19, 2009 at 1:24 PM, jpcook <[hidden email]> wrote:

>
> Hello,
>
> I have recently upgraded to Camel 2 which has a different implementation of
> splitting messages or seems to.
> http://camel.apache.org/splitter.html
>
> Specifically the CamelSplitIndex header. In my routebuilder I have used
> split and supplied my own SplitExpression class. This all works nicely and
> the log statements confirm this. I want to use the Exchange.SPLIT_INDEX and
> set that on my own component. But it is returning the string literal
> camelSplitIndex which is the default value defined in Exchange.java. I'm not
> sure If I have to set this header myself? But this all worked in camel 1.5
> using the Splitter.SPLIT_COUNTER?
>
>                        .split(new
> BatchSplitExpression("/locations/location", 10))
>                        .setBody(GroovyLanguage.groovy("'<?xml version=\"1.0\"
> encoding=\"UTF-8\"?><locations>'+request.body+'</locations>'"))
>                        .to("log:AfterSplit")
>                        .process(XsltBuilder.xslt(new
> File("xslt\\observations\\ceefax\\daily_observations.ceefax.xslt")))
>                        .to("log:AfterTransform")
>                        .process(new PlasmaPaginatorProcessor(18, false))
>                        .setHeader(PlasmaComponent.PLASMA_PAGE_NO,
> GroovyLanguage.groovy("'"+Exchange.SPLIT_INDEX+"'"))
>
> Thanks
> --
> View this message in context: http://www.nabble.com/Using-Exchange.SPLIT_INDEX-tp23614318p23614318.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



--
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus