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.

Friday, February 12, 2016

BPMN REST tasks with WSO2 BPS

WSO2 BPS supports invoking rest endpoints out of the box. Follow the following steps to add a RESTTask to your workflow using Activity BPMN 2.0 designer.

  1. Add the BPMN designer to your Eclipse installation using the update site here. 
  2. Start a new BPMN project.
  3. Add a new service task from the tasks palette.
  4. Go to the task properties panel and open main config tab.
  5. Select "Java class" as task type.
  6. Give "org.wso2.carbon.bpmn.extensions.rest.RESTTask" as the Class name.
  7. Now add fields with following names, and values in String value field, under documentation section.
    • serviceURL - rest service endpoint
    • method - http method to use
    • basicAuthUsername - username if the endpoints are secured
    • basicAuthPassword - password for the username above
    • input - payload to be sent
    • outputVariable - process variable to save the response
    • headers - header values in the format "key1:value1,key2:value2"
Now you can retrieve the response from the variable specified above in the succession steps of the workflow.

Refer the screenshot below to find out the important places you require inside eclipse designer.


Changing the endpoint after process deployment

The REST endpoint could not change after deploying the process in above method. If you want to change the endpoint after deploying the process also, pointing to a registry location which contains an endpoint reference as mentioned in Endpoint+References. For this add a field with name "serviceRef" instead of the "serviceURL" field and give the registry location of the service reference as the value.

Using json payloads

You can send json as the payload also.

Give the json payload to the input field. This time use the expression box in add field dialog to give the json value instead of string value box. Add new field called "outputMappings" and mention the mapping format from response json, similar to "var2:customer.name,var3:item.price" format.

EDIT on 14/05/2016

REST task sample

I have added a sample at BPMNRESTSample. This sample  make a REST call to a mocky.io endpoint and display the response in a user task. Deploy the sample in WSO2 BPS and start a new process instance from BPMN Explorer shipped with BPS.

Enjoy with REST!!