Set timeout for http-connector service task

Dear Sir,

I have a requirement from a customer. Please find the use case below

Workflow will call external application REST service using http-connector and result will send to another service task. Suppose external REST service took more time 1 minute to get the response then workflow should not wait more than 1 minute. It should continue to next service task in the workflow.

Basically, we need to set timeout to service task (http-connector) to wait for 1minute, suppose within 1 minute no response from service task then need to proceed further with the next service task in the same workflow. Do you have any solution? Please suggest with an example will be appreciated.

1 Like

Have a similar issue to resolve. How to make the process proceed ahead safely after a timeout on http-conection?

I can think of kicking in a timer and an event-message but how to ignore the output from that hanging http-connection completely? (else it will result into Optimistique :slight_smile: Locking exception)

Should I cancel the connection with a socket timeout. Should I write my own (spring) http delegate (do not know the advantage). Is it available through the engine (apache) http-connector (if so a snippet customizing it may help).

1 Like

Http-connector does not have a timeout. If the http connection remains open by the server then the connection will remain open and not close. This was an issue I ran into with camunda.

See:

As a fix it works very well and provides lots of options.

Edit: if you look at some of the linked posts on the jsoup thread you should see some of the background issues and examples.

1 Like

Hi,

I suspect that you may need a custom connector. Instructions to build a custom connector can be found here [1]

To set a custom timeout, I suspect you will need to insert code something like this;

int timeout = 5;
RequestConfig config = RequestConfig.custom()
.setConnectTimeout(timeout * 1000)
.setConnectionRequestTimeout(timeout * 1000)
.setSocketTimeout(timeout * 1000).build();
CloseableHttpClient client =
HttpClientBuilder.create().setDefaultRequestConfig(config).build();

regards

Rob

[1] HTTP Connector | docs.camunda.org