You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by PJ Walstroem <wa...@hotmail.com> on 2013/03/30 00:11:26 UTC

Design question: multicaster, request-reply and InOut

hello,
I'm in the process of integrating a number of external parties into a Flight
search service. However, I am not sure that our defined routes are optimal.
Could someone here do a sanity check? That would be highly appreciated!

Requirements: 
- send async requests to 20-30 external flight services. Not all of them are
applicable for each request, e.g. United Airlines does not offer Frankfurt -
Zürich, so no need to ask UA for that particular request (just an example, I
have no idea if UA really offers that flight :-)
- after each external response, it may be presented to the end-user (so no
aggregation before response is sent back to client). Each response should be
sent back to client ASAP
- each external response is different, so need to normalize it to our
internal format
- need to know when the last external response is received so the client can
stop polling

The EIP is typically a Recipient List, but we are using a multicaster as it
seems easier to handle the applicable-part in that way. Our route is listed
below. 
The FlightSearchProducers sendSearchRequest to external parties (e.g. United
Airlines) and put the response on "activemq:store". 
The storageProcessor calls our Solr-instance and stores the results there.
We are using the DLC errorHandler, with retries.

My concern is that camel looses control when the messages are multicasted;
they are out in the wild and after a while results start coming in on the
"activemq:store"-queue. I tried to wire up the multicaster with InOut and
let the results be routed to "direct:store", but it seems that the
multicaster waits for all messages to be processed? And we need to
aggregate?

Still, I am not sure if I need Camel to be in control the whole route. I
assume it would be easier to keep track of the number of external responses
and if all external responses are received (or exhausted) if Camel was in
total control, but this is just me guessing.

Any thoughts or feedback?

from("activemq:incoming").to("direct:multicast").end();

MulticastDefinition multicastDefinition =
from("direct:multicast").multicast().parallelProcessing();
for (FlightSearchProducer producer : producers) {
    multicastDefinition
            .filter().method(producer, "isApplicable")
            .bean(producer, "sendSearchRequest").end();
}

from("activemq:store").process(storageProcessor).end();



--
View this message in context: http://camel.465427.n5.nabble.com/Design-question-multicaster-request-reply-and-InOut-tp5730101.html
Sent from the Camel - Users mailing list archive at Nabble.com.