Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

Connection timeout not set for Connect-Http rule

SA-51919

Summary



Response timeout is not applied when connecting to unreacheable host via Connect-Http rule.
Response timeout on the "Service" tab set to 10000 (10 seconds), but timeout occurs long after that time.


Error Messages



Not Applicable


Steps to Reproduce



1. Create Connect-Http rule.
2. Set endpoint URL to unreachable host, example: "http://example.com" for server with no Internet access
3. Set response timeout to 10000.
4. Create activity rule and invoke Connect-Http method.
5. Run activity.


Root Cause



It is a functional limitation of HTTP connector. Connection timeout is not supported by HTTP connect rule. Only socket timeout works for HTTP connector.

Resolution



Perform the following local-change steps:

1. Switch to Connect-REST.
Connect-REST already provides the same functionality as Connect HTTP, so replacement is a matter of adjusting the configuration to use Connect-REST instead of Connect-HTTP.
Connect-REST provides every capability of Connect-HTTP and more. They use the same underlying implementation and expose nearly identical configuration semantics. Going forward enhancement will be done only in Connect-REST.

2. Implement a local change in invokeHTTPConnector activity to set the timeout.

Alternative local change:

Create a utility function called HostIsReachable, which takes these two arguments:
* String endpoint
* int timeout

The Rule-Utility-Function (RUF) should have a boolean return value and have this as its body:
try {
return java.net.InetAddress.getByName((new java.net.URL(endpoint)).getHost()).isReachable(timeout);
} catch (Exception e) { // add appropriate log output here if desired }
return false;

Use this utility function as a precondition for calling the connector in an activity step, with the HTTP endpoint URL as input to the function.

Published May 3, 2018 - Updated October 8, 2020

Was this useful?

0% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us