jeudi 16 juillet 2020

Spring boot design/approach to invoke multiple external apis

Below is my requirement. Need help in design approach in spring boot application. There are 2-3 external rest apis that are used to install/uninstall/rollback services at the cluster.

When i select trigger option in UI, it should uninstall and start installing new version of service after uninstall successful, if it fails then it should install back earlier service version.

Below are the activity that should happen and sequential order of apis

  1. Invoke DELETE rest api, this api returns response immediately, but the service at the cluster will take some time to get deleted.

2> since it takes time to delete, Using GET rest api multiple times(every 2 seconds) to check the status of uninstall service.

3> if uninstall service successful(Based on step2 GET API Polling), then initiate installing service using POST API with new version- this will take some time 4> If POST API success then complete. 5> If fails, then install earlier service version again POST REST API.

I was thinking whether we can do all these in 1 single job in spring boot.But not sure what to refer, what classes need to be used. Also help in design and any approach to achieve it.

Aucun commentaire:

Enregistrer un commentaire