I am storing the list of url's in the Apache camel header,below is the code,
List<String> supplierHotelRefs = new ArrayList();
supplierHotelRefs.add("a.com");
supplierHotelRefs.add("b.com");
supplierHotelRefs.add("c.com");
exchange.getIn().setBody(supplierHotelRefs);
Now i need to iterate this list present in the header and make a call to url's. This should be the parallel activity. I tried with split(..) which is working fine if we store the list in the body, But due to some constraints i can't store it in body. It will be helpful if i get code to iterate and parallely process the collection present in the Camel Header.
Regards, Raghavan
You could set the list in the header and split on that header.
exchange.getIn().setHeader("supplierHotelRefs",supplierHotelRefs);
In your route definition you could split based on the header property and process them parallely.
from("").....
//split based on the header
split(header("supplierHotelRefs"))
//process every split exchange parallely
.parallelProcessing()
//end split block
.end()
//continue route definition after split
.log("completed split processing")
Note that the caller thread will still wait for all the split messages to be completed.