Here is the use case that I m trying solve - So this is an extension to the my earlier thread, Apache camel to aggregate multiple REST service responses
I've used a Multicast component with custom aggregation strategy to fork the incoming request to sub requests and aggregate their responses. Everything works fine till this.
Now for one of the use case I want the incoming URL parameters to be passes selectively to some of the sub services. ex:
Incoming request - http://[host]/my-service/scan?foo=a&bar=b&baz=c
My Multicast component looks like this -
<multicast strategyRef="myAggregationStrategy" parallelProcessing="true">
<to REST_service_1"/>
<to REST_service_2"/>
</multicast>
I want to pass only foo=a to service_1 endpoint and bar=b&baz=c to service_2 endpoint.
Now, with Multicast the same set of request query parameters are getting passed to both service_1 and service_2. i.e. both service_1 and service_2 will receive foo=a&bar=b&baz=c (entire query params)
Option I m thinking (on high level) -
-to break the incoming url parameters and stick them as a headers then i can selectively use these headers to build CamelHttpQuery header for each individual "to service_call"
-But at the end, the Exchange is going to be shared among all the Multicast endpoints, so will this approach work at all?
-Or should I step back and think about different EIP altogether for this particular use case?
-Or I m thinking in a wrong direction :)
Appreciate the inputs! Thanks!