I have created a route that
- reads xml file
- split it
- aggregate it on basis of categories.After aggregation i am receiving arrays i-e array1 for category1, array2 for category2.
- When i write the file it results out to to print any random array from data set.
Question: How to print multiple files on basis of number of arrays generated by aggregator?
from("file:C:\\Users\\Desktop?fileName=books.xml&noop=true")
.split(xpath("/books/book"))
.process(new MyProcessor())
.setHeader("category", xpath("/book/@category").stringResult())
.aggregate(header("category"), new SetAggregationStrategy()).completionTimeout(500)
.process(new MyProcessor())
.convertBodyTo(String.class)
.to("file:C:\\Users\\Desktop\\New")
.end();