Hi,

We have problem with aggregator because messages are not aggregated but we
get only one message.

public class BookingRouteBuilder extends RouteBuilder {

    private static final String NAMESPACE = "http://kalafior.ru/booking/";;
    private static final String FLIGHTS = "direct:flights";
    private static final String HOTELS = "direct:hotels";

    public void configure() {
        from("jbi:endpoint:" + NAMESPACE +
"jms/clientRequestReader").multicast().to(FLIGHTS, HOTELS);

        from(FLIGHTS).filter().xpath("//booking-package-request/flights")
            .to("jbi:endpoint:
http://ypsilon.net/JMSProviderService/ypsilonRequestWriter";);

        from(HOTELS).filter().xpath("//booking-package-request/hotels")
            .to("jbi:endpoint:
http://www.gta-travel.com/JMSProviderService/gtaRequestWriter";);

        from("jbi:endpoint:
http://ypsilon.net/jms/ypsilonConnectorResponseWriter
").to("direct:aggregator");
        from("jbi:endpoint:
http://www.gta-travel.com/jms/gtaConnectorResponseWriter
").to("direct:aggregator");

        from("direct:aggregator").aggregator(new AggregationStrategy() {

            @Override
            public Exchange aggregate(Exchange oldExchange, Exchange
newExchange) {
                oldExchange.getIn().setBody(((String)
oldExchange.getIn().getBody()) + ((String) newExchange.getIn().getBody()),
String.class);
                return oldExchange;
            }

        }).body().to("jbi:endpoint: + NAMESPACE +
clientProviderService/clientProviderEndpoint");
    }
}


We want aggregate different messages from providers eg. flyghts, hotels,
rails and receive one message consist of those three. Please, any advise?

Tomasz Prus

Reply via email to