<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Viraj Weerasinghe on Medium]]></title>
        <description><![CDATA[Stories by Viraj Weerasinghe on Medium]]></description>
        <link>https://medium.com/@virajweerasinhe?source=rss-fe2c2965eedf------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*Odn6QVb3mDlmj_4A</url>
            <title>Stories by Viraj Weerasinghe on Medium</title>
            <link>https://medium.com/@virajweerasinhe?source=rss-fe2c2965eedf------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 20:23:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@virajweerasinhe/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[WSO2 API Manager 3.1.0 -Automate the disable endpoint suspension for all APIs]]></title>
            <link>https://medium.com/@virajweerasinhe/wso2-api-manager-3-1-0-automate-the-endpoint-suspension-disable-for-all-apis-a96191fe7446?source=rss-fe2c2965eedf------2</link>
            <guid isPermaLink="false">https://medium.com/p/a96191fe7446</guid>
            <dc:creator><![CDATA[Viraj Weerasinghe]]></dc:creator>
            <pubDate>Wed, 16 Aug 2023 08:12:09 GMT</pubDate>
            <atom:updated>2023-08-16T08:23:21.034Z</atom:updated>
            <content:encoded><![CDATA[<p>In this I am going explain how to disable the suspension for endpoint for all the API.</p><p>In API Manager, by default, the gateway suspends an API for 30 seconds when it cannot reach the endpoint. If another request is made to your API within those 30 seconds, it will not be sent to the backend. The following response appears when the endpoint is suspended.</p><p>&lt;am:fault<br> xmlns:am=”<a href="http://wso2.org/apimanager">http://wso2.org/apimanager</a>&quot;&gt;<br> &lt;am:code&gt;303001&lt;/am:code&gt;<br> &lt;am:type&gt;Status report&lt;/am:type&gt;<br> &lt;am:message&gt;Runtime Error&lt;/am:message&gt;<br> &lt;am:description&gt;Currently , Address endpoint : [ Name : somename-AT-sometenant — test_me_APIproductionEndpoint_0 ] [ State : SUSPENDED ]&lt;/am:description&gt;<br>&lt;/am:fault&gt;</p><p>In order to prevent the endpoint suspension for a particular API endpoint we need to add below configuration to API.xml (Also you can change this in the publisher portal UI[2])</p><p>* please note this a sample example.</p><p>&lt;endpoint name=”admin — testApi_APIproductionEndpoint_0&quot;&gt;<br> &lt;address uri=”<a href="http://localhost:9000/services/SimpleStockQuoteService">http://localhost:9000/services/SimpleStockQuoteService</a>&quot;&gt;<br> &lt;timeout&gt;<br> &lt;duration&gt;30000&lt;/duration&gt;<br> &lt;responseAction&gt;fault&lt;/responseAction&gt;<br> &lt;/timeout&gt;<br> <strong>&lt;suspendOnFailure&gt;<br> &lt;errorCodes&gt;-1&lt;/errorCodes&gt;<br> &lt;initialDuration&gt;0&lt;/initialDuration&gt;<br> &lt;progressionFactor&gt;1.0&lt;/progressionFactor&gt;<br> &lt;maximumDuration&gt;0&lt;/maximumDuration&gt;<br> &lt;/suspendOnFailure&gt;</strong><br> &lt;markForSuspension&gt;<br> &lt;errorCodes&gt;-1&lt;/errorCodes&gt;<br> &lt;/markForSuspension&gt;<br> &lt;/address&gt;<br>&lt;/endpoint&gt;</p><p>If is there is a special requirement to prevent the endpoint suspension for all the APIs, we have to change this one by one. If there is 100 APIs this will be a huge task. In order to automate this process we can go with the below approach.</p><p>Since the ‘endpoint_template.xml file used to generate endpoint.xml for all APIs we can edit the ‘<strong>endpoint_template.xml</strong>’ as below. (APIM_HOME/repository/resources/api_templates)</p><p>Please find the below code lines which set the default endpoint suspension configurations</p><p><strong>Change this :</strong></p><blockquote>#if( $config.get(“suspendDuration”) == 0)</blockquote><blockquote>&lt;suspendOnFailure&gt;</blockquote><blockquote>&lt;errorCodes&gt;-1&lt;/errorCodes&gt;</blockquote><blockquote>&lt;initialDuration&gt;0&lt;/initialDuration&gt;</blockquote><blockquote>&lt;progressionFactor&gt;1.0&lt;/progressionFactor&gt;</blockquote><blockquote>&lt;maximumDuration&gt;0&lt;/maximumDuration&gt;</blockquote><blockquote>&lt;/suspendOnFailure&gt;</blockquote><blockquote>&lt;markForSuspension&gt;</blockquote><blockquote>&lt;errorCodes&gt;-1&lt;/errorCodes&gt;</blockquote><blockquote>&lt;/markForSuspension&gt;</blockquote><blockquote>#else</blockquote><blockquote>&lt;suspendOnFailure&gt;</blockquote><blockquote>#print_list(“errorCodes”, $config.get(“suspendErrorCode”))</blockquote><blockquote>#print_if_exist_only(“initialDuration”, $config.get(“suspendDuration”))</blockquote><blockquote>#print_if_exist_only(“maximumDuration”, $config.get(“suspendMaxDuration”))</blockquote><blockquote>&lt;progressionFactor&gt;#print_if_exist($config.get(“factor”), 1.0)&lt;/progressionFactor&gt;</blockquote><blockquote>&lt;/suspendOnFailure&gt;</blockquote><blockquote>&lt;markForSuspension&gt;</blockquote><blockquote>#print_list(“errorCodes”, $config.get(“retryErroCode”))</blockquote><blockquote>&lt;retriesBeforeSuspension&gt;#print_if_exist($config.get(“retryTimeOut”), 0)&lt;/retriesBeforeSuspension&gt;</blockquote><blockquote>&lt;retryDelay&gt;#print_if_exist($config.get(“retryDelay”), 0)&lt;/retryDelay&gt;</blockquote><blockquote>&lt;/markForSuspension&gt;</blockquote><blockquote>#end</blockquote><p><strong>To This :</strong></p><blockquote>&lt;suspendOnFailure&gt;</blockquote><blockquote><strong>&lt;errorCodes&gt;-1&lt;/errorCodes&gt;</strong></blockquote><blockquote><strong>&lt;initialDuration&gt;0&lt;/initialDuration&gt;</strong></blockquote><blockquote><strong>&lt;progressionFactor&gt;1.0&lt;/progressionFactor&gt;</strong></blockquote><blockquote><strong>&lt;maximumDuration&gt;0&lt;/maximumDuration&gt;</strong></blockquote><blockquote>&lt;/suspendOnFailure&gt;</blockquote><blockquote>&lt;markForSuspension&gt;</blockquote><blockquote>&lt;errorCodes&gt;-1&lt;/errorCodes&gt;</blockquote><blockquote>&lt;/markForSuspension&gt;</blockquote><p>In Above we can change suspension configurations to prevent endpoint suspension configurations. Please restart the server after changing this configurations.</p><p>Furthermore, to add the suspension disable configuration to an already published API, you can redeploy the API. Please go to the life cycle and redeploy the API.</p><p><strong>References :</strong></p><p>[1].<a href="https://apim.docs.wso2.com/en/3.1.0/learn/design-api/endpoints/resiliency/endpoint-suspension/#:~:text=In%20API%20Manager%2C%20by%20default,when%20the%20endpoint%20is%20suspended">https://apim.docs.wso2.com/en/3.1.0/learn/design-api/endpoints/resiliency/endpoint-suspension/#:~:text=In%20API%20Manager%2C%20by%20default,when%20the%20endpoint%20is%20suspended</a>.</p><p>[2].<a href="https://apim.docs.wso2.com/en/3.1.0/learn/design-api/endpoints/resiliency/prevent-api-suspension/">https://apim.docs.wso2.com/en/3.1.0/learn/design-api/endpoints/resiliency/prevent-api-suspension/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a96191fe7446" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>