I got a requirement that i have on main route and child route. In the main route will get the list of objects, there i need to make a call to child route for each individual elements in the list. Then in Child route will make a call to web-service by appending that element as one of the parameter.
Code:
from("direct:SupplierRoute")
.choice()
.when(header(IS_SUPPLIER_AVAILABLE).isEqualTo(true))
.split(body())
.parallelProcessing()
.streaming()
.to("direct:SUPGetHotelAggregatorRatesRQ")
.bean(parallelProcessingRequestProcessor)
.end()
.end()
.end();
from("direct:SUPGetHotelAggregatorRatesRQ")
.process(startOperation(DISTRIBUTION, GET_HOTEL_AGGREGATOR_RATES_API_GENERATE_VM_REQUEST))
.to("velocity:velocity/GetHotelAggregatorRatesRQToGetHotelSupplierRatesRQ.vm")
.process(endOperation(DISTRIBUTION, GET_HOTEL_AGGREGATOR_RATES_API_GENERATE_VM_REQUEST))
.end();
I'm setting the value to the exchange body as below,
public static final List<HotelRefs.HotelRef> supplierHotelRefs = new ArrayList();
exchange.getIn().setBody(supplierHotelRefs);
But the above code sample was not working,If anyone let us know if there is any approach in camel to iterate over user defined collections at route level.
Thanks, Raghavan