Hello,
I am trying to use spring and spring integration in a new project that i am working on, and i was wondering how do i accomplish this with spring integration. Below is the scenario i have.
I have the spring integration app set up on the back end with a generic servlet. I am NOT using spring-mvc, as our project does not need it, thus i have configured the war using spring and a generic servlet. I use spring integration because i read that it has very poweful capabilites. To tap into spring integration from the code which the servlet calls, i use the spring integration gateway. What the gateway then needs to do is call three different webservices and aggregate the response, and store it as one result set.
To achieve the above i have the gateway call a pub sub channel which spawns two threads, one to get make a call to 1 web service, the other two do some transformation and make the remaining calls to two other web services. The two other calls are made via a pub sub channel as well which spawns two different threads and both these threads call a web service. what i am trying to do based on my little knowledge on spring integration after the above 3 major web service calls via different threads at different points, i have all the web service response into the same aggregator at the end, as this is the place where i need to combine the three different responses to be able to use it. I could have done the above processes synchronously, i.e make 1 web service calls after the other but then that would be slow, and that's why i use this approach which i believe will help me a lot in terms of efficiency.
The problem i face in the above is if i have the apply sequence property set to true on the pub sub channels, the aggregation of all the three messages do not happen as intended.. i get a batch of 2 and 1, thus i thought, i'd set up a custom release strategy, and to do this i make the apply sequence property to false, and now i am able to release the aggregation after the three responses come back... and the release strategy i have set up is a basic one, which says if payload.size() == 3, then release, which works fine for one request to the gateway and then one response from the aggregation. But now i do not how would i scale this to multiple requests to the gateway from different threads as in the ideal world all these requests would be made from different browsers, which will thus be multithreaded, and i am afraid when this situation happens, how would it recognize which of the 3 payloads it should consider to be able to release it?. to add to a note is, when i tried two requests to this process one after the other, then the first request worked fine as expected, but then the second request got lost somewhere and the release strategy was never called. so the second request was not served.
what i need to know is how should i use spring integration to accomplish my needs, i am sure there must be a fairly simple way to do this, but i am not just able to go about it. Any suggestions would be greatly appreciated.
I am not sure if the above makes any sense, but if you have any questions, please let me know, and i'll try my best to explain myself.


Reply With Quote
