i got it
just used recipientList instead of specifying multiple to's
from("direct:carlo").recipientList(header("overrideRecipients")).aggregationStrategy(new
GroupedExchangeAggregationStrategy()).process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
// TODO Auto-generated method stub
System.out.println("Hello World.");
List<Exchange> messageList = (List<Exchange>)
exchange.getProperty(Exchange.GROUPED_EXCHANGE);
for(Exchange messageExchange : messageList) {
LOG.info("Hello there.");
}
System.out.println(exchange.getProperty(Exchange.GROUPED_EXCHANGE));
}
});
On Tue, Jun 1, 2010 at 11:12 PM, Carlo Camerino <[email protected]>wrote:
> Hi,
>
> I need to send a single message into three separate web services. i'm
> assuming that I need to use the recipient list component right?
> the next thing I need to do is to combine the results of those three web
> services and put them into one.
>
> am i right? is it
>
> Recipident List --> Aggregator
>
> My route seems to not be working,
>
> i'm not sure of what expression to use as it says to use a constant
> expression.
>
> my requirement is to combine the result of three separate web services. i'm
> using camel 2.3.0 and am looking at camel aggregator2
>
> thanks
> carlo
>
> from("direct:carlo").multicast().to("cxf://
> http://localhost:8088/override/override?serviceClass=" +
> SERVICE_CLASS,"cxf://http://localhost:8089/override/override?serviceClass="
> + SERVICE_CLASS, "cxf://
> http://localhost:8090/override/override?serviceClass=" +
> SERVICE_CLASS).aggregate(constant("ALL"), new AggregationStrategy() {
>
> @Override
> public Exchange aggregate(Exchange oldExchange, Exchange
> newExchange) {
> // TODO Auto-generated method stub
> LOG.info("New Exchange Body IN: " +
> newExchange.getIn().getBody());
> LOG.info("New Exchange Body OUT: " +
> newExchange.getOut().getBody());
>
> newExchange.getOut().setBody(newExchange.getIn().getBody());
> LOG.info(" IS It Passing here.");
> return newExchange;
> }
> })
>