An endpoint in simple terms is a URL (destination) that can be used by any WSO2 service which needs to send a message to that particular destination / API.
The endpoints can be configured for both external and internal services, peer services running inside the same ESB instance or from the host system.
One of the important configurations that is often overlooked are the endpoints error handling.
As any network oriented application, messages can get lost due to various tcp errors, connection timeouts, etc.,
Therefore for a successful and controlled behaviour, endpoint error handling plays a major role.
The default behaviour of WSO2 endpoints are, if messages in those endpoint are failed, the endpoint will be marked as “suspended” and thereby causing failure of the subsequent messages.
This is more important if multiple internal services are consumed as part of an exposed Proxy service or API.
To handle the different errors and timeouts from the internal services and thereby control the response and errors to the end client, its important to manage the errors of endpoints.
Few important configurations are listed out here and a working sample configuration.
Configurations for “timeout” settings:
duration – Connection timeout interval. If the service doesn’t respond by this time, the endpoint will be marked as “Timeout” state. In Timeout state, the endpoint can still send or receive messages but if the error continues, the endpoint will be marked as “suspended”.
responseAction – When a response is received to a timed out request, this parameter specifies whether to discard it or to invoke the fault handler. The default value is none.
The following sample configuration can be used to completely disable the endpoint suspension behaviour of the endpoints.
Configure the Timeout, MarkForSuspension and suspendOnFailure settings as shown in the below configuration for the same.
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="service_ep"> <address statistics="disable" trace="disable" uri="http://localhost:9765/services/stores_Operation"> <timeout> <duration>20000</duration> <responseAction>fault</responseAction> </timeout> <markForSuspension> <errorCodes>-1</errorCodes> </markForSuspension> <suspendOnFailure> <initialDuration>0</initialDuration> <maximumDuration>0</maximumDuration> <progressionFactor>1.0</progressionFactor> </suspendOnFailure> </address> </endpoint>