Catch Service not available exception

We have a requirement that our system should goes first into production while we need to call another system via REST service which is not yet scheduled for production. Our idea is to call the required service via Service Task with http-connector (the endpoint is already known and the interface is agreed) and in case of exception “Service is not available” to set some dummy result value to continue the process.

We have tried responseCode variable on service task as well as boundary error event but not succeed with a valid process. We have set asynchronous before on service task allowing the process to be started but we just end up with incident which cannot be somehow resolved until the other system is up and running. How could we handle the requirement?

1 Like

Can you provide a sample bpmn if your example code?

1 Like

Currently the sample process is really a test sampe.

testService.bpmn (10.2 KB)

@alexeib see:

@StephenOTT, thanks for the reference. I have already seen it but it seems that with script I may process an error when the service has been successfully called and has returned HTTP code about error (ex., 401). I can check responseCode variable provided by connector and throw BPMN Error.

I have also found the links bellow with similar questions/solutions:

  1. https://forum.camunda.org/t/rest-api-service-task-error-handling/2888
  2. https://groups.google.com/forum/#!topic/camunda-bpm-users/syyEUCLB61I

But my actual concern is how can I catch with a script the case when connector execution end up with exception in log file like ENGINE-16004 Exception while closing command context: HTCL-02007 Unable to execute HTTP request because the service is not available.

The straightforward solution we see is to have a process variable which holds a condition whether to execute a service or not. But if the service has to be executed and it is not available then there should be an incident the operator has to clarify and resume the process after the service issue has been resolved.

Did you try a try/catch on your response variable in the output?

Also take a look at Replacing Http-Connector with Jsoup usage

I found it to be more flexible of a option.

Have you solved this problem? When service is not reachable it is not going into a boundary event just creates an incident log…