Hi,
I have a searchRequest object that consists of a list of search objects. Each of the search objects contains search data and a property that describes which search destinations the search object should be sent to. I need to add concurrency and a sound error handling mechanism so that I can show the results that did return in addition to showing an error list describing which calls that failed.
Ideally I want a caller thread that waits for each of its spawned threads to return and then gather the results and failures to the response channel of a gateway.
Any pointers?
Example of structure
SearchRequest
- Search object 1
- Search destination 1
- Search destination 2
- Search object 2
- Search destination 2
- Search destination 3
I have implemented the following in Spring Integration:
Request
SearchGateway > SearchSplitter (splits on the different search objects and sends to an executor channel for concurrency on the different search objects) > Search Router (routes to the destinations described in each search object and uses an executor channel for concurrency on the different search destinations) > Transformer > outbound gateway
Response
Outbound gateway > Transformer > Aggregator > SearchGateway
The search gateway looks like this:
Code:
@Gateway(requestChannel = ”searchOutputChannel”, replyChannel = ”searchAggregatedInputChannel”)
SearchReponse search(SearchRequest searchRequest)