WSO2 ESB endpoint using cached backend name - wso2

We can see calls going from ESB to backend system old Ip instead of the new IP. For example
Wso2 ESB Endpoint configured as: somebackend.com
If we do nslookup to see the IP of the system.
$nslookup somebackend.com
10.20.30.40
If we trace the traffic from ESB using tcpdump with host as "somebackend.com" then calls are going to old IP of the system (somebackend.com) i,e, 50.60.70.80 instead of new IP 10.20.30.40
Is the name/Ip/DNS Name is cached anywhere in the WSo2 ESB.?
Any suggestions, please resolve this.
Below is the endpoint file configured.
<endpoint xmlns="http://ws.apache.org/ns/synapse"
name="conf//endpoint/endpointname">
<property name="System-Name" value="Backend" scope="default" type="STRING"/>
<http uri-template="somebackend.com"
method="get">
<suspendOnFailure>
<errorCodes>-1</errorCodes>
<initialDuration>0</initialDuration>
<progressionFactor>1.0</progressionFactor>
<maximumDuration>0</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<errorCodes>-1</errorCodes>
</markForSuspension>
</http>
</endpoint>

Can you check in your /etc/hosts file whether you have wrongly mapped the old IP to the domain name (somebackend.com)? It might be a possibility because AFAIK ESB does not cache IP. Maybe restarting the ESB server would also help.

AFAIR WSO2 ESB does not cache endpoint IPs. Can you run a traceroute command on "somebackend.com" from the ESB node and check whether how DNS resolves from your machine?

Wso2 will store the connection details in connection pool and re-use the same connection details for the next calls instead new one. We added below property before making a call to the endpoint to initiate a fresh new connection for each call which resolved our issue.
FYI: https://docs.wso2.com/display/ESB490/HTTP+Transport+Properties
Thanks for the support guys.

Related

WSO2 EI - Handle SFTP errors and invoke Fault/error Sequence

I'm trying to write a SFTP location through a jms/http proxy. However when there is an error on SFTP endpoint (wrong password, network connectivity issue, remote Dir not exists) I want to trigger fault sequence and handle this error (Try some DLC kind of scenario). I found that fault Sequcence is not invoking for FTP errors unless you set OUT_ONLY=false. However WSO2 docs recommends set OUT_ONLY=true for ftp writes. Similar Question is asked here too. How to handle VFS proxy error in WSO2 EI 6.4?
If I set OUT_ONLY=false it triggers faultSquence for both failures and success FTP writes.
Any workaround to catch FTP errors and trigger faultSequence ?
You can define a responseAction in the endpoint configuration. Please refer to the following sample configuration. The responseAction spedifies when a response comes to a timed out request specifies whether to discard it or invoke the fault handler. Apart from defining the responseAction in the endpoint, you can replace the send mediator with the file connector and it will also invoke the fault sequence during an error.
<send>
<endpoint name="wms-fault-endpoint">
<address uri="vfs:ftp://admin:admin1#localhost:2121/testJ/out">
<timeout>
<duration>10000</duration>
<responseAction>fault</responseAction>
</timeout>
</address>
</endpoint>
</send>
[1]-https://docs.wso2.com/display/EI611/Endpoint+Error+Handling
[2]- https://docs.wso2.com/display/ESBCONNECTORS/File+Connector

WSO2 Integrator: How to setup FIX Initiator failover?

How can I configure a WSO2 Integrator FIX initiator endpoint which utilizes automatic session failover supported by Quickfix/J?
In Quickfix/J, it is possible to configure automatic failover of the initiator session using the FIX config file as follows (assuming two localhost FIX servers listening on ports 9997,9998)
[SESSION]
SenderCompID=SYNAPSE
TargetCompID=EXEC
SocketConnectHost=localhost
SocketConnectPort=9997
SocketConnectHost1=localhost
SocketConnectPort1=9998
ReconnectInterval=5
All examples in WSO2 documentation show FIX endpoints configured with a hardcoded host such as:
<send>
<endpoint>
<address uri="fix://localhost:9997?BeginString=FIX.4.4&SenderCompID=SYNAPSE&TargetCompID=EXEC"/>
</endpoint>
</send>
This pattern is not possible for us because the target FIX server is on a remote server with a hostname that is different per environment, so I never want to hardcore the target host like this.
Ideally I would like to do something like this:
<send>
<address uri="fix://<dynamic hostname>:9997?BeginString=FIX.4.4&SenderCompID=SYNAPSE&TargetCompID=EXEC"/>
// the endpoint representing the above FIX Session
// where the target host is dynamically defined
// and not hardcoded anywhere in my car application
</send>
On the receiver/listener side as a Proxy Service this works fine, because in the proxy service it lifts the configuration from the supplied initiator config URL parameter, so the failover happens "under the hood" by the FIX engine.
<parameter name="transport.fix.InitiatorConfigURL">quickfix.cfg</parameter>
However it doesn't look like it's possible to do the same when you are sending a message to the target FIX server.
Does anyone have a good suggestion or an example for how to achieve this?
As you are using a normal 'address endpoint' you should also be able to use the normal failover configurations: see https://docs.wso2.com/display/ESB500/Configuring+Failover+Endpoints for info.

WSO2 ESB: retry HTTP request after timeout

I'm using WSO2 ESB to route API requests send to an application hosted on Heroku, through proxy service.
In the last few days, we've noticed connections to the Heroku app would timeout from time to time, resulting in the failure of the whole client process.
Those requests are part of a long process (video transcoding), so relaunching the entire process just because 1 out of 40 requests failed is not really an option. It would be best to retry every failed request automatically a second (or n) time(s).
Implementing "retry on timeout" directly into client code is a mess, so we thought the could handle it for us by configuring the endpoint to retry all timed out requests. The WSO2 ESB documentation on endpoint error handling, advertises it's possible by setuping a failover group that contains only one leaf endpoint, dealing with my exact use case when "even rare message failures are not acceptable".
However, the provided sample configuration seem to continue dropping messages:
<endpoint name="SampleFailover">
<failover>
<endpoint name="Sample_First" statistics="enable" >
<address uri="http://localhost/myendpoint" statistics="enable" trace="disable">
<timeout>
<duration>60000</duration>
</timeout>
<markForSuspension>
<errorCodes>101504, 101505, 101500</errorCodes>
<retriesBeforeSuspension>3</retriesBeforeSuspension>
<retryDelay>1</retryDelay>
</markForSuspension>
<suspendOnFailure>
<initialDuration>1000</initialDuration>
<progressionFactor>2</progressionFactor>
<maximumDuration>64000</maximumDuration>
</suspendOnFailure>
</address>
</endpoint>
</failover>
</endpoint>
I'm still seeing log entries in wso2carbon.log such as:
[2016-04-13 16:02:50,576] WARN - Expiring message ID : urn:uuid:fd515b80-8d67-47e5-b409-0ec39ed58fc6; dropping message after timeout of : 60 seconds {org.apache.synapse.core.axis2.TimeoutHandler}
What am I missing here ?
I add some difficulties with this topic, and it is yet not clear if the endpoint can itself retrigger and timed out call.
After reading this tutorial : https://www.yenlo.com/blog/wso2torial-error-handling-in-wso2-esb-with-wiremock?success=true, it seems that yes, but I'm not sure...
Have you already tried to remveo the error codes ?
<timeout>
<duration>60000</duration>
<responseAction>fault</responseAction>
</timeout>
<suspendOnFailure>
<initialDuration>1000</initialDuration>
<progressionFactor>2.0</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>3</retriesBeforeSuspension>
<retryDelay>1000</retryDelay>
</markForSuspension>

WSO2 indirect Endpoint inside Failover Group

Is it possible to use an Indirect Enpoint inside the definition of a Failover Group endpoint?
I mean something like this:
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="failOver2">
<failover>
<endpoint key="LBEndpoint" />
</failover>
</endpoint>
Where LBEndpoint is a load balance endpoint defined and saved previously in the registry.
When i click on the Save button... all my configuration is lost and the fail over group comes back into this form:
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="failOver2">
<failover/>
</endpoint>
Is this a bug? Inside the WSO2 ESB documentation it says that all this is possible.
Can you try editing synapse configuration directly? That is, not using sequence editor UI. Go to sourceview and manually edit and point the endpoint key in failoverendpoint.

Configure WSO2 ESB for corporate proxy so it can access external URIs

How do I configure WSO2ESB such that I can proxy a service that I currently have hosted on Windows Azure?
On my local development machine I have an instance of WSO2ESB, I can use this to proxy WCF services also on my local development machine, but now I need to take this proof of concept work further and show how WSO2ESB could be used to proxy for WCF services hosted externally, in this instance on Windows Azure.
I have tried to add a new Proxy Service for my Azure service selecting Specify source URL for the Publishing WSDL and then entering the .svc address for my Azure service, but when I Test URI (which takes about a minute) it returns
Invalid WSDL URI (Unable to establish a connection)
I believe this to be caused by our corporate proxy and my machine needing to supply basic information in order to punch a hole out but I cannot see how / where to do this.
I am using WSO2ESB 4.5.1 and my Proxy Service source is:
<proxy xmlns="http://ws.apache.org/ns/synapse" name="Azure"
transports="https,http"
statistics="disable" trace="disable" startOnLoad="true">
<target>
<outSequence>
<send/>
</outSequence>
<endpoint>
<address uri="http://myazureservice.cloudapp.net/Service.svc"/>
</endpoint>
</target>
<description></description>
</proxy>
Update
I have also tried importing the WSDL the service generates by copying it to the clipboard and pasting it into WSO2 but this is rejected.
You can download the wsdl to your local filesystem with the extension of *.wsdl, and provide its link to the "publishWSDL" option