We are facing an issue with wso2 ESB endpoint getting suspended for 3000ms when the URL it tries to invoke is not available for a second, because of this suspension the next calls to the same endpoint gets fail even when the backend URL is available.
Below is the same Log what we get when an endpoint gets suspended and also the endpoint configuration what we are using now.
TID: [-1234] [] [2019-10-30 15:08:39,121] WARN {org.apache.synapse.endpoints.EndpointContext} - Endpoint : conf//endpoint/epsomebackendurl with address https://somebackendurl.com will be marked SUSPENDED as it failed
TID: [-1234] [] [2019-10-30 15:08:39,121] WARN {org.apache.synapse.endpoints.EndpointContext} - Suspending endpoint : conf//endpoint/epsomebackendurl with address https://somebackendurl.com - current suspend duration is : 30000ms - Next retry after : Wed Oct 30 15:09:09 GMT 2019
Endpoint Configuration
<?xml version="1.0" encoding="UTF-8"?>
<endpoint xmlns="http://ws.apache.org/ns/synapse"
name="conf//endpoint/epsomebackendurl">
<property name="System-Name" value="JUNIFER" scope="default"
type="STRING"/>
<http uri-template="https://somebackendurl.com"
method="get">
<suspendOnFailure>
<progressionFactor>1.0</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
<retryDelay>0</retryDelay>
</markForSuspension>
</http>
</endpoint>
Please let me know is there any other option that we can make to stop endpint getting suspended.
We are using wso2esb-5.0.0 version.
Thanks
The default behavior is faulting a request of Synapse endpoint is, the endpoint will suspend for 30000ms.
If you want to stop suspending, the following endpoint is never suspended.
<endpoint name="NoSuspendEndpoint">
<address uri="http://localhost:9000/services/SimpleStockQuoteService">
<timeout>
<duration>30000</duration>
<responseAction>fault</responseAction>
</timeout>
<suspendOnFailure>
<errorCodes>-1</errorCodes>
<initialDuration>0</initialDuration>
<progressionFactor>1.0</progressionFactor>
<maximumDuration>0</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<errorCodes>-1</errorCodes>
</markForSuspension>
</address>
Related
I'm trying to call an endpoint from a sequence using WSO2 Integration Studios. Whenever I define the endpoint in-line, my code works fine and I get a response from the endpoint. Whenever I define the endpoint as a separate entity, it stops working and I get the following error-message: "MESSAGE = An unexpected error occurred., REST_API = null, ERROR_CODE = 305100, ERROR_MESSAGE = Couldn't find the endpoint with the key..."
My code looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="XMLSeq" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<log category="TRACE" description="Log Request Payload"/>
<call description="Send request to the endpoint">
<endpoint key="TestEndpoint" />
</call>
</sequence>
<?xml version="1.0" encoding="UTF-8"?>
<endpoint name="TestEndpoint" xmlns="http://ws.apache.org/ns/synapse">
<http method="get" uri-template="https://[api]">
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>1.0</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</http>
</endpoint>
For reference, my code does work when it looks like this:
`<?xml version="1.0" encoding="UTF-8"?>
<sequence name="XMLSeq" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<log category="TRACE" description="Log Request Payload"/>
<call description="Send request to the endpoint">
<endpoint name="TestEndpoint" xmlns="http://ws.apache.org/ns/synapse">
` <http method="get" uri-template="https://[api]">
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>1.0</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</http>
</endpoint>
</call>
</sequence>
This "Couldn't find the endpoint with the key.." error occurred when EI/ESB cannot find the endpoint configuration in the synapse configuration space.
Check whether you have added it to the composite application project when bundling all the synapse xml artefacts to the .car file.
This is the error I get in the console:
[2022-02-17 08:55:40,121] ERROR {org.apache.axis2.description.ClientUtils} - The system cannot infer the transport information from the nio-local://services/my_first_project_data-services URL.
[2022-02-17 08:55:40,122] WARN {org.apache.synapse.endpoints.EndpointContext} - Endpoint : ep.insertUserAddress with address nio-local://services/my_first_project_data-services will be marked SUSPENDED as it failed
[2022-02-17 08:55:40,123] WARN {org.apache.synapse.endpoints.EndpointContext} - Suspending endpoint : ep.insertUserAddress with address nio-local://services/my_first_project_data-services - current suspend duration is : 30000ms - Next retry after : Thu Feb 17 08:56:10 EET 2022
[2022-02-17 08:55:40,125] WARN {org.apache.synapse.transport.passthru.util.PassThroughTransportUtils} - Unable to set the HTTP status code from the property HTTP_SC with value:
This is my API source code:
<?xml version="1.0" encoding="UTF-8"?>
<api context="/api/dbtask/insert" name="api.dbtask.insert" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="POST">
<inSequence>
<call blocking="true">
<endpoint key="ep.insertUserAddress"/>
</call>
<respond/>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
</api>
This is my endpoint source code:
<?xml version="1.0" encoding="UTF-8"?>
<endpoint name="ep.insertUserAddress" xmlns="http://ws.apache.org/ns/synapse">
<address uri="nio-local://services/my_first_project_data-services">
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>1.0</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</address>
</endpoint>
This is my dataservice source code:
<data name="my_first_project_data-services" serviceNamespace="" serviceGroup="" transports="http https">
<description/>
<config id="default">
<property name="org.wso2.ws.dataservice.driver">com.mysql.jdbc.Driver</property>
<property name="org.wso2.ws.dataservice.protocol">jdbc:mysql://localhost:3306/utilizatori</property>
<property name="org.wso2.ws.dataservice.user">root</property>
<property name="org.wso2.ws.dataservice.password">1234</property>
</config>
<operation name="insertUser" returnRequestStatus="true">
<call-query href="insertUser"/>
</operation>
<query id="insertUser" useConfig="default">
<sql>INSERT INTO utilizatori.users (id, nume, varsta) VALUES (14, "Alexandru", 50)</sql>
</query>
</data>
The thing is when I'm trying the service here, it works:
I'm using Postman to send requests
What am I doing wrong?
There is an issue with the data service URL you have configured "nio-local://services/my_first_project_data-services". The format of the data service endpoint should look like follows [1].
http://localhost:8280/services/RDBMSDataService/employee
But if your intention is to use the local transport, you first need to enable the local transport. You can find more information on this in the blog post [2].
[1]-https://docs.wso2.com/display/EI660/Exposing+a+Datasource+as+a+Data+Service
[2]-https://mcvidanagama.medium.com/install-dss-features-to-esb-and-enable-local-transport-for-data-service-endpoints-f4866495a8d7
Let's say we have a micro integrator communicating with several services.
We want to be able to cluster one of the services, for example if we send two requests to a service we want each of these requests to be processed by a different node of a service, is that possible?
Services are third party REST API, we want to send requests to two different URL.
There is Load-BalanceEndPoint element in the Integration studio element, but it's not clear how it works, or even if it permit us to solve the issue above.
Could anyone help us resolve this problem/explain how we should use mentioned endpoint?
Yes, you can use Load-Balance Endpoint for your usecase. Have a look at the following sample configurations.
API configuration :
<?xml version="1.0" encoding="UTF-8"?>
<api context="/loadbalance" name="checkLoadBalance" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="GET">
<inSequence>
<call>
<endpoint key="testLoadBalance"/>
</call>
<respond/>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
</api>
Endpoint Configuration :
<?xml version="1.0" encoding="UTF-8"?>
<endpoint name="testLoadBalance" xmlns="http://ws.apache.org/ns/synapse">
<loadbalance algorithm="org.apache.synapse.endpoints.algorithms.RoundRobin">
<endpoint name="endpoint_urn_uuid_6179155B57847314A657084710149040-304004407">
<http method="GET" uri-template="http://www.mocky.io/v2/5e574b1c3000006000fd38cd">
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>1</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</http>
</endpoint>
<endpoint name="endpoint_urn_uuid_6179155B57847314A657084710149040-304004407">
<http method="GET" uri-template="http://www.mocky.io/v2/5185415ba171ea3a00704eed">
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>1</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</http>
</endpoint>
</loadbalance>
<description/>
</endpoint>
Here I have used two different mocky endpoints. They will return {"Hello": "World"} and {"hello": "world"}.
After deploying, if I invoke checkLoadBalance API for first time, I will get response from the first endpoint. If I invoke for the second time, I will get response from the second endpoint. Here I have given the algorithm as Roundrobin. Hence it will scheduled in a RoundRobin manner.
I am new to WSO2 EI.
Task: I am sending a message to Endpoint queue and if the endpoint queue is not reachable, I have to retry for 3 times and still its not reachable then I have to send message to another queue.
Approach: I got many links in Stack Overflow.
I am using below code in my endpoint.
<?xml version="1.0" encoding="UTF-8"?>
<endpoint name="DestinationEndPoint" xmlns="http://ws.apache.org/ns/synapse">
<address uri="jms:/TARGET?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://192.168.1.33:61616&transport.jms.DestinationType=queue"/>
<timeout>
<duration>30000</duration>
<responseAction>fault</responseAction>
</timeout>
<suspendOnFailure>
<errorCodes>-1</errorCodes>
<initialDuration>0</initialDuration>
<progressionFactor>1.0</progressionFactor>
<maximumDuration>0</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>3</retriesBeforeSuspension>
<errorCodes>-1</errorCodes>
</markForSuspension>
</endpoint>
I have given the wrong IP so that while sending message it will fail.
But the issue is at 1st trial only its sending the message to error queue, but I have to retry for 3 times and then I have to send to error queue.
Can you please give me any suggestions?
I have different services and there respective endpoints in my WSO2 DSS like
http://localhost:9764/services/Get_details/
http://localhost:9764/services/muser_DataService/
etc
so,when am creating a proxy service in WSO2 ESB i want to give a default endpoint in my proxy rather then the particular endpoint in DSS
For this approach i used Recipient List Group as shown below
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="Endpoint">
<endpoint name="null_value">
<address uri="http://localhost:9764/services/null_value/">
<suspendOnFailure>
<progressionFactor>1.0</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
<retryDelay>0</retryDelay>
</markForSuspension>
</address>
</endpoint>
<endpoint name="Get_details">
<address uri="http://localhost:9764/services/Get_details/">
<suspendOnFailure>
<progressionFactor>1.0</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
<retryDelay>0</retryDelay>
</markForSuspension>
</address>
</endpoint>
<endpoint name="Get_geodetails">
<address uri="http://localhost:9764/services/Get_geodetails/">
<suspendOnFailure>
<progressionFactor>1.0</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
<retryDelay>0</retryDelay>
</markForSuspension>
</address>
</endpoint>
<endpoint name="muser_DataService">
<address uri="http://localhost:9764/services/muser_DataService/">
<suspendOnFailure>
<progressionFactor>1.0</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
<retryDelay>0</retryDelay>
</markForSuspension>
</address>
</endpoint>
But when am using this endpoint in my proxy, process is failing to find the required endpoint in the created Recipient List Group and throwing an error as shown below
"Fault":{"faultcode":"axis2ns2:Client","faultstring":"The endpoint reference (EPR) for the Operation not found is \/services\/Get_details\/ and the WSA Action = null. If this EPR was previously reachable, please contact the server administrator.","detail":""}
What can be done for a successful execution......
Recipient endpoint is used for different purpose. You should have different endpoint definition, if your backend service URL is different. Then use proper endpoint in your proxy.