You're viewing Apigee Edge documentation.
Go to the
Apigee X documentation. info
This document explains how to configure the connection timeout for the Apigee Edge Message Processors.
The connection timeout represents time for which the Message Processor waits to establish
connection with the target server. The default value of the connection timeout property on the
Message Processor is 3
seconds. This timeout period is applicable to the
backend servers configured in the target endpoint configuration and in the
ServiceCallout
policy of your API proxy.
The connection timeout for Message Processors can be increased or decreased from the default value of 3
seconds based on your needs. It can be configured in the following ways:
- In the API proxy
- In the target endpoint
- In the
ServiceCallout
policy
- On the Message Processor
The following properties control the connection timeout on the Message Processors:
Property name | Location | Description |
---|---|---|
connect.timeout.millis |
API proxy:
|
This is the maximum time which the Message Processor waits to connect with the target server.
By default, this property takes the value set for the
If this property is modified with a new timeout value for the target server associated with an API proxy, then the connect time only for that target server is affected. |
HTTPClient.connect.timeout.millis |
Message Processor |
This is the maximum time which the Message Processor waits to connect to the target server. This property is used for all the API proxies running on this Message Processor.
The default value of this property is
You can either modify this property as explained in
Configuring connection timeout on Message Processors below, or you can overwrite this value
by setting the |
Before you begin
Before you use the steps in this document, be sure you understand the following topics:
- If you aren’t familiar with connection timeout, see the
connect.timeout.millis
property description in TargetEndpoint Transport Property Specification. - If you aren’t familiar with configuring properties for Edge on Private Cloud, read How to configure Edge.
Configuring connection timeout in API proxy
The connection timeout can be configured in the API proxy in the following places:
- Target endpoint
ServiceCallout
policy
Configuring connection timeout in target endpoint of API proxy
This section explains how to configure connection timeout in the target endpoint of your API proxy.
The connection timeout can be configured through the property connect.timeout.millis
,
which represents the connection timeout value in milliseconds.
- In the Edge UI, select the specific API proxy in which you would like to configure the new connection timeout value.
- Select the specific target endpoint that you want to modify.
- Add the property
connect.timeout.millis
with an appropriate value under the<HTTPTargetConnection>
element in theTargetEndpoint
configuration.For example, to change the connection timeout to
5
seconds, add the following block of code:<Properties> <Property name="connect.timeout.millis">5000</Property> </Properties>
Since the
connect.timeout.millis
property is in milliseconds, the value for5
seconds is5000
.The following examples show how to configure the connection timeout in the target endpoint configuration of your API proxy:
Example target endpoint configuration using URL for backend server
<TargetEndpoint name="default"> <HTTPTargetConnection> <URL>https://mocktarget.apigee.net/json</URL> <Properties> <Property name="connect.timeout.millis">5000</Property> </Properties> </HTTPTargetConnection> </TargetEndpoint>
Example target endpoint configuration using target server
<TargetEndpoint name="default"> <HTTPTargetConnection> <LoadBalancer> <Server name="target1" /> <Server name="target2" /> </LoadBalancer> <Properties> <Property name="connect.timeout.millis">5000</Property> </Properties> <Path>/test</Path> </HTTPTargetConnection> </TargetEndpoint>
- Save the changes made to your API proxy.
Configuring connection timeout in ServiceCallout policy of API proxy
This section explains how to configure the connection timeout in the ServiceCallout
policy of your API proxy. The connection timeout can be configured through the
connect.timeout.millis
property, which represents the connect time value in
milliseconds.
To configure the connection timeout in the ServiceCallout
policy using the
connect.timeout.millis
property:
- In the Edge UI, select the specific API proxy in which you would like to configure the new
connection timeout value for the
ServiceCallout
policy. - Select the specific
ServiceCallout
policy that you want to modify. - Add the property
connect.timeout.millis
with an appropriate value under the<HTTPTargetConnection>
element in theTargetEndpoint
configuration.For example to change the connection timeout to
5
seconds, add the following block of code:<Properties> <Property name="connect.timeout.millis">5000</Property> </Properties>
Since the
connect.timeout.millis
property is in milliseconds, the value for5
seconds is5000
.The following examples show how to configure the connection timeout in the
ServiceCallout
policy of your API proxy:Example ServiceCallout policy configuration using URL for backend server
<ServiceCallout name="Service-Callout-1"> <DisplayName>Service Callout-1</DisplayName> <HTTPTargetConnection> <Properties> <Property name="connect.timeout.millis">5000</Property> </Properties> <URL>https://mocktarget.apigee.net/json</URL> </HTTPTargetConnection> </ServiceCallout>
Example ServiceCallout policy configuration using target server
<ServiceCallout enabled="true" name="Service-Callout-1"> <DisplayName>Service Callout-1</DisplayName> <Response>calloutResponse</Response> <HTTPTargetConnection> <LoadBalancer> <Server name="target1" /> <Server name="target2" /> </LoadBalancer> <Properties> <Property name="connect.timeout.millis">5000</Property> </Properties> <Path>/test</Path> </HTTPTargetConnection> </ServiceCallout>
- Save the changes made to your API proxy.
Configuring connection timeout on Message Processors
This section explains how to configure the connection timeout on the Message Processors.
The connection timeout can be configured through the property
conf_http_HTTPClient.connect.timeout.millis
, which represents the connection timeout
value in milliseconds on the Message Processor component, using the token according to the
syntax described in
How to configure Edge.
To configure the connection timeout on the Message Processors, do the following:
- On the Message Processor machine, open the following file in an editor. If it does not
already exist, then create it.
/opt/apigee/customer/application/message-processor.properties
For example, to open the file using
vi
, enter the following:vi /opt/apigee/customer/application/message-processor.properties
- Add a line in the following format to the properties file, substituting a value for
TIME_IN_MILLISECONDS:
conf_http_HTTPClient.connect.timeout.millis=TIME_IN_MILLISECONDS
For example, to change the connection timeout on the Message Processor to
5
seconds, add the following line:conf_http_HTTPClient.connect.timeout.millis=5000
- Save your changes.
- Ensure the properties file is owned by the
apigee
user as shown below:chown apigee:apigee /opt/apigee/customer/application/message-processor.properties
- Restart the Message Processor as shown below:
/opt/apigee/apigee-service/bin/apigee-service edge-message-processor restart
- If you have more than one Message Processor, repeat the above steps on all the Message Processors.
Verifying connection timeout on Message Processors
This section explains how to verify that the connection timeout has been successfully modified on the Message Processors.
Even though you use the token conf_http_HTTPClient.connect.timeout.millis
to set
the connection timeout on the Message Processor, you need to verify if the actual property
HTTPClient.connect.timeout.millis
has been set with the new value.
- On the Message Processor machine, search for the property
HTTPTransport.connect.timeout.millis
in the/opt/apigee/edge-message-processor/conf
directory and check to see if it has been set with the new value as shown below:grep -ri "HTTPClient.connect.timeout.millis" /opt/apigee/edge-message-processor/conf
- If the new connection timeout value is successfully set on the Message Processor, then the
above command shows the new value in the
http.properties
file.The sample result from the above command after you have configured connection timeout to
5
seconds is as follows:/opt/apigee/edge-message-processor/conf/http.properties:HTTPClient.connect.timeout.millis=5000
In the example output above, notice that the property
HTTPClient.connect.timeout.millis
has been set with the new value5000
inhttp.properties
. This indicates that the connection timeout is successfully configured to5
seconds on the Message Processor. - If you still see the old value for the property
HTTPClient.connect.timeout.millis
, then verify that you have followed all the steps outlined in Configuring connection timeout on Message Processors correctly. If you have missed any step, repeat all the steps again correctly. - If you are still not able to modify the connection timeout, then contact Google Cloud Apigee Edge Support.