WSO2 Governance Registry - Apply Tags using Handler

There can be scenarios, where users want to apply tags into their resources, while resource is inserted. I am writing this post based on my answer provided to this Stack Overflow question.

Question was on how to apply a tag into a service in WSO2 Governance Registry at the time of the service creation. We can use Registry Handler for achieving this requirement. Handlers are the well-known extension points in WSO2 Governance Registry.

"Handlers are pluggable components, that contain custom processing logic for handling resources. All handlers extend an abstract class named Handler, which provides default implementations for resource handling methods as well as a few utilities useful for concrete handler implementations."[WSO2 Governance Registry Docs]

I have modified handler sample, which is shipped with Governance Registry pack. Using above link please download the G-Reg pack and handler sample is located at GREG_HOME/samples/handler.

public void put(RequestContext requestC…

How to configure WSO2 G-Reg with ELB - Updated

This is the updated post for configuring WSO2 ELB 2.1.0 and G-Reg 4.6.0 releases. If you are using earlier releases, please refer the early post.

 When we are fronting WSO2 ELB(Elastic Load Balancer) for a WSO2 G-Reg(Governance Registry) node, all the incoming messages will go through ELB node and it will act as a HTTP and HTTPS proxy to GREG node. So when you configure ELB to the GREG front, GREG won't be able to access alone without the ELB.

1. Download WSO2 ELB and WSO2 GREG. Rename the extracted ELB as ELB-HOME and extracted GREG as GREG-HOME.

ELB Configuration 

2. Go to ELB-HOME/repository/conf/loadbalancer.conf and add the following entry. There can be multiple entries according to the clustering requirements.

governance {

domains   {
           wso2.governance.domain {
               tenant_range *;                group_mgt_port 4000;                mgt{                    hosts;                }            }        } }
 3. Update hosts files in node…

Manage SOAPAction of the Out Message

When you are sending a request message to a backend service through WSO2 ESB, there could be some scenarios where you need to remove or change the SOAPAction header value.

Using header mediator and property mediator which are available in WSO2 ESB, we can remove SOAPAction or set it empty.

Set SOAPAction as Empty:
<header name="Action" value=""/> <property name="SOAPAction" scope="transport" value=""/>
Remove SOAPAction:
<header action="remove" name="Action"/> <property action="remove" name="SOAPAction" scope="transport"/>
Modify SOAPAction:

When setting SOAPAction one of the below approches can be used

1) .
<header name="Action" value="fixedAction"/>
<header expression="xpath-expression" name="Action"/>
More Info: Header Mediator

If we need to monitor the messages getting passed between ESB and…

Oracle JDBC driver for Maven

When you are adding the oracle jdbc driver to your project as a dependency, you will not be able to get it resolved from the public repository. This is happening due to license compatibility issue. Therefore you have to manual install Oracle JDBC driver into your local repo or private repo.

This is not limited to Oracle JDBC driver, there are some JARs which are not available in the public repos. Oracle JDBC drover can be downloaded from their web site
When you are adding a JAR to the repository or project, you can refer "Maven add jar without install" post or below command.

mvn install:install-file -DartifactId=ojdbc14 -Dversion= -Dpackaging=jar -Dfile=ojdbc.jar -DgeneratePom=true
 If you need to add JARs in to Central Repository this Maven guide will help.

How to get MySQL Database Size

While carrying out Performance Tests for WSO2 Governance Registry, I had to measure(calculate) MySQL database size. So here I am posting the query which I used to measure the MySQL database size, hoping this could be useful to someone.

SELECT table_schema "Database Name", Round(Sum(data_length + index_length) / 1024 / 1024, 3) "Database Size in MB" FROM   information_schema.tables  GROUP  BY table_schema;

Once this query is executed you can view the database size in formation like this::

mysql> SELECT table_schema "Database Name", Round(Sum(data_length + index_length) / 1024 / 1024, 3) "Database Size in MB" FROM   information_schema.tables  GROUP  BY table_schema;
| Database Name      | Database Size in MB |
| db11                       |               1.834 |
| db12                       |               1.834 |

Performance Results - WSO2 Governance Registry - Part 1

Recently I have completed a performance analysis for WSO2 Governance Registry. Here I am publishing some of the results.

Zip Upload Thread Pool Size

Whats is Zip Upload Thread Pool:

When we are uploading ZIP files with WSDLs & Schema's, it hits the ZipWSDLMediaTypeHandler. There we can optimize number of threads which are working on Uploading WSDLs, Schema's and Service creation.

Recommended Other Configuration:
Increased the timeouts for the UI to 7200000 in axis2_client.xml. Disabled WSDL and Schema validation in registry.xml. Disabled registry indexing in registry.xml. Stopped automatic versioning of resources. Set the number of maximum active DB connections to 120 and max_connection in to 500(MySQL level), and the maximum wait time to 600000. Set G-Reg memory configurations to 4GB With above configurations,here is test results for different thread upload pool size. Uploaded ZIP file containing 280 WSDLs and 506 Schema files. Time measured in Minutes and uploaded zip file …

Monitor WSO2 carbon Instance using New Relic

While I was doing a performance analysis of WSO2 Governance registry, I was looking for a way to monitor information of Apache Solr and its performance numbers. While reading "Apache Solr 3 Enterprise Search Server" book I found this very real time monitoring Tool(site) called New Relic.

So I was able to integrate New Relic with WSo2 Governance Registry Server and was able to monitor many information about the server instance. There I found that Java Agent Self Installer is not working for my scenario. So I had to set Java agent information into JAVA_OPTS. After Few minutes(around 2 min) I was able to view my server related information in the newrelic console(

Here is the JAVA_OPTS which I have used:

export JAVA_OPTS="$JAVA_OPTS -javaagent:/home/chandana/Documents/g-reg/newrelic/newrelic.jar"

newrelic Java agent self-installer :