-
1. Re: Camel split
njiang Jan 19, 2011 10:08 PM (in response to allanon76)Hi,
I'm not sure what you want to do.
Can you show me your first in message?
If the authentication is failed, you can check the result with Predicates, and here are some example for the Content Based Router.
Willem
-
2. Re: Camel split
allanon76 Jan 20, 2011 5:28 AM (in response to njiang)There are a lot of technologies here that I've never used so maybe I'm saying a lot o stupid things :P... sorry
Anyway, the message can be something similar to this (not exactly this one because I'm still working on this and I've still to decide what to send):
I want for example split this message in 4 different messages to be sent to 4 different services. (for now I've 2 REST services and two SOAP )
one of them should be blocking ( the one that validate the token ).
In case the response is negative I've to follow another route.
The 3 other can be parallel but I need at the end to aggregate all the data in only one response to client.
This is more or less the full scenario.
Thanks
Michele
Edited by: allanon76 on Jan 20, 2011 10:28 AM
-
3. Re: Camel split
davsclaus Jan 20, 2011 9:40 AM (in response to allanon76)Its a bit like the Composed Message Processor
http://camel.apache.org/composed-message-processor.html
Or the Scatter-Gatter
http://camel.apache.org/scatter-gather.html
In Camel the Splitter has a build in Aggregator, so that's fairly simple. Just provide it with an AggregationStrategy, and implement the "merge" logic there.
http://camel.apache.org/splitter.html
If you want to understand these patterns in more depth then consider the Camel in Action book. Chapter 8 covers the splitter, aggregator very deeply.
Its in print so you can find it any any of the major web bookstores.
-
4. Re: Camel split
njiang Jan 20, 2011 9:42 AM (in response to allanon76)I don't think split can do what you want , you may take a look at the loan broker example.
-
5. Re: Camel split
allanon76 Jan 21, 2011 8:59 AM (in response to njiang)Hi,
thanks for the suggestion.
This is what I've done
from("jetty:http://dicerto-m-gil:7777/osqi?bridgeEndpoint=true")
.process(new AuthenticateProcessor("http://host/authentication.php?bridgeEndpoint=true"))
.multicast(new OSAggregationStrategy())
.parallelProcessing()
.to("http://host/somepath/service.php?bridgeEndpoint=true","http://host:7890/openscout/osqi?wsdl&bridgeEndpoint=true");
the problem with this is that using multicast send to all endpoints the same message.
For this reason I used interceptors
interceptSendToEndpoint("http://host:7890/*").process(new DumpBody("INTERCEPTED TO OQSI"));
interceptSendToEndpoint("http://host/*").process(new DumpBody("INTERCEPTED TO l3s"));
to manipulate the exchange before sending it to the final service.
The problem is that it seems only one endpoint receive the correct message, to the second one the body of the exchange is empty.... how it is possible?
The DumpBody processor just write in the log the body of the exchange and what I've is
in one case
DumpBody | com.els.os.camel.DumpBody 23 | 234 - camel - 0.0.1.SNAPSHOT | INTERCEPTED TO OQSI <++++++> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:open="http://opens
and in second case the DUMP as an empty body
DumpBody | com.els.os.camel.DumpBody 23 | 234 - camel - 0.0.1.SNAPSHOT | INTERCEPTED TO l3s <++++++>
Where I'm wrong?
-
6. Re: Camel split
davsclaus Jan 21, 2011 11:06 AM (in response to allanon76)You need to enable stream caching with Jetty as a stream can only be read-once.
-
7. Re: Camel split
allanon76 Jan 24, 2011 10:44 AM (in response to davsclaus)Thanks,
the multicast works now.
Regards,
m.