I am creating a web service with a RESTful interface (lets call it MY_API ). This service relies on another RESTful web service to handle certain aspects (calling it OTHER_API ). I would like to determine what types of best practices I should use to handle OTHER_API failures.
Scenario
My user interface is a one-page javascript application. There are several fairly complex actions that a user can take that can easily complete a minute or two for the user. When they are done, they press the SAVE button, and MY_API is called to save the data.
MY_API has everything you need to save information provided by the user. However, there is an action that must be performed using OTHER_API. For example, OTHER_API may handle sending emails. Or maybe it is processing the addition of line items to my billing statement. In both cases, these are critical things that must be completed, but they should not happen right now, they just have to happen in the end.
If OTHER_API fails, I don’t just want to tell the user that their action failed because they spent a lot of time on it and this will make the experience less optimal.
Questions
- So, do I have to create some kind of message or event queue that can save these failed REST requests in OTHER_API and process them later?
- , REST ?
- , - REST JSON? Java , .
- , ?