Friday, August 18, 2017

WSO2 ESB - Adding a thread sleep

There can be situations where your ESB logic need thread sleeps to delay the executions. In WSO2 ESB, this can be easily done using the script mediator.

Following is the synapse code of the script mediator to add 1000ms thread sleep.



Feel free to use and share !! 

Friday, June 23, 2017

WSO2 ESB / EI Mediation Latencies with JMX monitoring

WSO2 ESB/EI is equipped with JMX monitoring capabilities. This is explained in WSO2 docs. But with this configurations you can't see advance mediation statistics like mediation level latencies. In order to enable them, add following two entries in the passthru-http.properties file. 

synapse.passthrough.latency_view.enable_advanced_view=true
synapse.passthrough.s2slatency_view.enable_advanced_view=true

Then you can view the time taken in mediation layer (request and response) separately apart from the total latencies.


Cheers!

Friday, June 16, 2017

WSO2 BPS : BPEL Versionning

The versioning of bpel processes is very useful when you need to update a process which is already in production. If you try to undeploy the existing process and deploy the updated process, it will remove all the existing process instances of the previous BPEL package also. Versioning enables updating your processes without affecting existing instances.

BPEL packages(.zip) with same name are eligible for versioning. If two packages with same name are different in content, BPS will retire the existing version and deploy a new version with the new package.
There are three ways you can deploy a BPEL process in BPS. Let's see how versinning works in each of method.

  • Deploying through management console - versioning is supported.
  • Deploying through a carbon application (capp) - versioning not supported.
  • Deploying by copying the package to deployment directory - If you replace the existing package, versioning is supported. But if you remove existing one and later copy the new package, it will un-deploy the old package.



Tuesday, May 23, 2017

WSO2 ESB message flow

This post explains the message flow of the synapse which is the main building block of WSO2 ESB.

Synapse receives the message from the axis2 transport layer. Inside this transport layer, message will be built based on the content type of the message and then passed over to the Synapse. 

Following is the Inflow of the message from the entry point to synapse,



Inside the Axis2FlexibleMEPClient.send() method, a callback is registered in axis2 transport layer and message is dispatched out of the synapse. Then the axis2 transport layer format this message based on the content type and send it to the backend.

When the response is coming from a backend service, transport layer identifies this and synapse response path is invoked.

Following is the synapse response path,



This completes the message flow for the following proxy service configuration.



Monday, May 22, 2017

Processing Binary Data from TCP transport in WSO2 ESB

This post describes how to process binary data over TCP transport in WSO2 ESB.


  • First we need to enable binary transport. Add following entries in ESB_HOME/repository/conf/axis2/axis2.xml. 

  • Now you need to add the message formatters and message builders to be used. Since we are using binary data, add following entry inside messageFormatters element. 
          Add following entry inside messageBuilders element. 

  • Now you can add a tcp proxy service to process the message. In that proxy service you need to add the same content type used in messageFormatter and messageBuilder configs. There are several other parameters specific to TCP proxies. Refer [1] for more info on that. Following is a sample proxy service that prints the binary message. 

  • Now you can invoke this proxy service using a sample TCP client. End of message should be marked with a "|" symbol in this particular proxy service. 

Thursday, March 9, 2017

Installing new features to WSO2 EI

In WSO2 Enterprise Integrator, you cannot install new features via management console. That option has been removed. So in order to install a feature, we must use the POM based feature installation. This is explained in WSO2 docs [1]. There few changes you need to made in order to this POM.xml to work.

  • The "destination" element value should be changed to, "wso2ei-6.0.0/wso2/components".
  • Value of the "dir" attribute in "replace" element should be, "wso2ei-6.0.0/wso2/components/default/configuration/org.eclipse.equinox.simpleconfigurator".
Optionally, Other than downloading p2 repo (which is over 2GB), the URL to P2 repo "http://product-dist.wso2.com/p2/carbon/releases/wilkes/" can be set as "metadataRepository" and "artifactRepository".

Following is a sample pom.xml that is used to install HL7 feature in EI.


[1] - https://docs.wso2.com/display/Carbon440/Installing+Features+using+pom+Files

Tuesday, March 7, 2017

Resolving SSL related issue in WSO2 products for MySql 5.7 upward

If you try to start aWSO2 product with Mysql 5.7 it will give the following warning and the product will not work.

Wed Dec 09 22:46:52 CET 2015 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.


This can be avoided for development purposes by not using SSL. For this the JDBC url for the database should be appended with "useSSL=false". But it cannot be appended with a & sign like in a normal URL. Use the following format. If not it may give xml parsing errors.


Then it will work as usual.