An endpoint is a specific destination for a message such as an address, WSDL, a failover group, a load-balance group etc. WSO2 API Manager supports a range of different endpoint types, allowing the API Gateway to connect with advanced types of backends.
|HTTP endpoint||A REST service endpoint based on a URI template.|
|Address endpoint||The direct URL of the service.|
|Failover Group endpoint|
The endpoints that the service tries to connect to in case of a failure. Selecting the endpoint when the primary endpoint get failed happens in a round robin manner.
Failover Group is a group of leaf endpoints(i.e, address endpoint, HTTP endpoint and WSDL endpoint). The failover group endpoint try to send the message to another endpoint when failure occur in current endpoint (while sending a message). Failover group ensures that a message is delivered as long as there is at least one active endpoint among the listed endpoints.
|Load Balance endpoint||The endpoints where the incoming requests are directed to in a round robin manner. They automatically handle fail-over as well.|
The dynamic endpoint sends the message to the address specified in the To header. You can configure dynamic endpoints by setting mediation extensions with a set of conditions to dynamically change the To header. For details of configuring endpoints to change the default mediation flow, see Adding Mediation Extensions.
Note the following:
- You can expose both REST and SOAP services to consumers through APIs.
- You cannot call backend services secured with OAuth through APIs created in the API Publisher. At the moment, you can call only services secured with username/password.
The system reads gateway endpoints from the
<APIM_HOME>/repository/conf/api-manager.xmlfile. When there are multiple gateway environments defined, it picks the gateway endpoint of the production environment. You can define both HTTP and HTTPS gateway endpoints as follows:
If both types of endpoints are defined, the HTTPS endpoint will be picked as the server endpoint.
Tip: When you define secure (HTTPS) endpoints, set the
<parameter name="HostnameVerifier"> element to
AllowAll in the
<APIM_HOME>/repository/conf/axis2/axis2.xml file's HTTPS transport sender configuration:
If not, the server throws an exception.
Configuring Load Balancing Endpoints
WSO2 API Manager provides configuring load balancing endpoints through the API Publisher.
To configure load balanced endpoints go to the edit view of the API and navigate to the Implement tab and select the Load Balanced check box.
Following are the other configurations that you need to do in order to specify a load balancing endpoint.
The set of production endpoints can be specified here where te requests need to be load balanced. You can specify more than one endpoint by clicking on "+" sign and can delete the endpoints by clicking on "-" sign.
|Sandbox endpoints||The set of sandbox endpoints can be specified here where te requests need to be load balanced. You can specify more than one endpoint by clicking on "+" sign and can delete the endpoints by clicking on "-" sign|
The load balancing algorithm is specified here.
The default is Round Robin Algorithm which has the className of org.apache.synapse.endpoints.algorithms.RoundRobin . If you select other from the dropdown list of Algorithms you need to specify the class name of the algorithm. Classnames of other algorithms can be found here.
A session management method from the load balancing group. The possible values are as follows.
None - If this is selected, session management is not used.
Transport - If this is selected, session management is done on the transport level using HTTP cookies.
SOAP - If this is selected, session management is done using SOAP sessions.
Client ID - If this is selected, session management is done using an ID sent by the client.
|Session Timeout||The number of milliseconds after which the session would time out.|
After completing the configuration click save and publish the API.
Configuring Failover Group of Endpoints
WSO2 API Manager provides configuring failover group endpoints through the API Publisher.
To configure failover endpoints go to the edit view of the API and navigate to the Implement tab and click Failover under endpoint type.
At leaset one failover endpoint need to be added for production and sandbox (if you have specified) Endpoints.
You can specify more than one endpoint by clicking on "+" sign and can delete the endpoints by clicking on "-" sign.
After completing the adding endpoints, click save and publish the API.
Advanced Endpoint Configuration
WSO2 API Manager provides controlling the production and sandbox endpoints with the Advanced Endpoint Configuration.
To configure your endpoints with this feature, go to the edit view of the API, navigate to the Implement tab and click the cogwheel icon next to the endpoint you want to configure.
The Advanced Endpoint Configuration dialog box appears as below.
Following are the configurations that we can do with the Advanced Endpoint Configurations. You can do advanced configurations for both production and sandbox endpoints.
|Endpoint Suspend State|
If you want to configure the suspension of an endpoint specifying error codes, maximum suspension time, suspension factors etc., you can use the endpoint suspension state in the Advanced Endpoint Configuration.
Error Codes: Error codes in the drop down list which need to make the endpoint suspension. If the selected error codes are received from the endpoint, the endpoint will be suspended. Specify the transport error codes where the endpoint suspension should be triggered. You can select single or error codes here.
Initial duration:The time duration for which the endpoint will be suspended, when one or more suspend error codes are received from it for the first time.
When creating (or updating) Failover endpoints through the Publisher UI (in the Implement tab), you need to go into this configuration box of each endpoint and specify a set of Error Codes for the endpoint to fail over on and take off the Initial Duration by setting its value to -1.
Max duration: The maximum time duration for which the endpoint is suspended when suspend error codes are received from it.
Factor: The duration to suspend can vary from the first time suspension to the subsequent time. The factor value decides the suspense duration variance between subsequent suspensions.
|Endpoint Timeout state|
Configurations of retry, error codes and delays in terms of endpoint timeout can be configured with the endpoint timeout state in the Advanced Endpoint Configuration.
Error Codes: A list of error codes. If these error codes are received from the endpoint, the request will be subjected to a timeout.
Retries Before Suspension: The number of re-tries in case of a timeout, caused by the above listed error codes.
Retry Delay: The delay between retries in milliseconds.
Duration and the response actions after a connection timeout can be configured here in the Advanced Endpoint Configuration.
Action: Response action to be performed after connection timeout. You can select from Never Timeout, Discard Message, and Execute Fault Sequence. The default value is Execute Fault Sequence.
Duration: The time duration of connection timeout in milliseconds.
if you want to change the endpoint connection timeout duration globally affecting all APIs, do the following.
Note that the socket timeout value should be greater than both the synapse global timeout and any endpoint timeouts given for your API.
For more information about endpoints and how to add, edit or delete them, see the WSO2 ESB documentation.