Set timeout for endpoints when Call mediator blocking true

Dilsi Chandrasena
2 min readDec 12, 2017

--

  • This blog is based on ESB 5.0.0.
  • I tested this using below API.

<api xmlns=”http://ws.apache.org/ns/synapse" name=”TestAPI” context=”/testing”>
<resource methods=”POST GET”>
<inSequence>
<log level=”full”/>
<call blocking=”true”>
<endpoint>
<address uri=”http://dilsi:8080/test/”/>
</endpoint>
</call>
<respond/>
</inSequence>
<outSequence>
<log level=”full”/>
<send/>
</outSequence>
</resource>
</api>

  • I created MockService as the endpoint using SoapUI. Then I set a script as (sleep(120000)) to keep the back-end as inactive for a period of time.
  • After sending the request, if the response from the backend will be delayed, the endpoint timeout has occurred after 30 seconds.
    So, we can see an exception backend of the ESB server as below.
  • Timeout has occurred after 30 seconds.
  • If we need to set the endpoint timeout to 1 minute, we cannot do it using the endpoint timeout parameters.
  • But we can set a timeout in axis2_blocking_client.xml file as SO_TIMEOUT timeout parameter under transportSender of <ESB_HOME>/repository/conf/axis2 directory as below.
    It will globally apply to all the blocking calls.

<transportSender name=”http” class=”org.apache.axis2.transport.http.CommonsHTTPTransportSender”>
<parameter name=”PROTOCOL”>HTTP/1.1</parameter>
<parameter name=”Transfer-Encoding”>chunked</parameter>
<parameter name=”cacheHttpClient”>true</parameter>
<parameter name=”defaultMaxConnectionsPerHost”>200</parameter>
<parameter name=”SO_TIMEOUT”>60000</parameter>
</transportSender>

  • After restarting and sending a request, we could see the endpoint timeout after 1 minute as below.

--

--

Dilsi Chandrasena
Dilsi Chandrasena

No responses yet