WSO2 ESB - Disable Endpoint Suspension


Endpoints

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 services and also internal, peer services running inside the same ESB instance or 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 behavior, endpoint error handling is very important. 

The default behavior of endpoints in WSO2 is, 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:

"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

Sample Configuration

The following sample configuration can be used to completely disable the enpoint suspension behavior 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>

Comments

  1. Endpoint Security (or) Endpoint Protection refers to the approach of protecting a business network when accessed by remote devices like smartphones, laptops, tablets or other wireless devices. It includes monitoring status, software, and activities.

    ReplyDelete

Post a Comment

Popular posts from this blog

WSO2 ESB - How to track messages between mediation flows

Endeca Baseline Indexing Issue - Perl Script Error