Reputation: 273
I have created a route that via a splitter does multiple lookups, aggregates the responses and returns the list of objects.
I use a remote proxy to invoke the route.
Given that there are multiple branches on the route it is possible that some will succeed and some will fail. How can I get all the returned results but also a list of failures, with reasons for failures, from the remote proxy?
I can think of 3 options, but hope there is something cleaner
Are there any other options?
Upvotes: 0
Views: 112
Reputation: 407
You should be able to get exception details in Aggregation strategy class and accordingly take action.
It depends on what you want to achieve from overall design. As a general practice, if you want consumer of your remote practice to fail on errors, it should get the exception details immediately. If your remote proxy is a REST Endpoint, it can return with 500 error. And similar strategy can be followed for other protocols.
Upvotes: 1
Reputation: 3191
I would go with option 3. Route all the errors to a generic error endpoint where you log the errors and return some default response. That way you can refer to that generic error endpoint from all your branches ensuring they will all react the same way whenever they encounter an error.
Upvotes: 1