I have a workflow where at a certain point, I want Flowable to update an outside system via a rest call. I can make the rest call just fine, but I want to make this robust. What is the best known method for re-trying a rest call automatically (maybe a short wait or sleep) if the outside system is unavailable. I’m not talking an error where the server receives a call and responds with a 4XX or 5XX error status code. I mean something like when you get “this site can’t be reached”. Could be that the app crashed and is no longer listening, or the whole server crashed, or maybe there was a network issue at the time of the request. Thank you.
Additional Information: When I turn off the system and make the test call, I can input the user form and click “Complete” upon completion. I see 3 dots at the top of the screen (while it tries to hit the http server) and then I see a red error stating “Internal Server Error” and then I am given the option to complete again. I was hoping the user task would be separate from the http task, but it appears that when I click complete on the user task, it attempts the http task and if it fails, it does not complete the user task.
hope this helps
More Additional Information:
After the user clicks complete on the form, an email is sent. and I receive it. However, since the server is offline, the rest call fails. The status of the flow is set back to getUser and when the user clicks complete again, another email is sent, and the rest call fails again. Why does the system not know an email was sent. and retry the http request from that point? Am I doing something wrong, or was flowable not built to handle such a situation?
Flowable works based on wait states. Which means that when your BPMN process is being executed and something fails the entire transaction will be rollbacked to the last wait state. In your case your last wait state is the user task.
You have multiple options how to solve this:
- Mark your http task as asynchronous (this makes it a wait state). With this flag the process will create an async job for the http task and the user task will be completed successfully. Later the job will be picked up and executed. If it fails it will be retried. Have a look at the Demystifying the Asynchronous Flag and Demystifying the Asynchronous Flag (II) for more information about that flag.
- Play with the
ignoreExceptionflag on the Http Task. See Http Task Configuration for more information
- You can also work with the exception mapping for the Bpmn Task (you would need to know the exception that is thrown in your case) and then have a BPMN Error on your task