Posts

WSO2 G-Reg Modify Subject of the Email Notification

WSO2 Governance Registry generates notifications for events triggered by various operations performed on resources and collections stored in the repository. Notifications can be consumed in a variety of formats including E-mail. The sample "E-mail NotificationCustomization" shows how we can modify the content of emails. It describes how to edit email body and restrict email notification to some email addresses.

Here I am going to extend that sample to modify Subject of the email.

private void editSubject(MessageContext msgContext, String newSubject) { ((Map) msgContext.getOptions().getProperty( MessageContext.TRANSPORT_HEADERS)).put(MailConstants.MAIL_HEADER_SUBJECT, newSubject); }

You will have to import "org.apache.axis2.transport.mail.MailConstants;" class and other related Java util classes as well.

When you are building the sample code, please follow the instructions available in the Governance Registry Sample Documentation.

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 governance.local.wso2.com;                }            }        } }
 3. Update hosts files in node…

Manage SOAPAction of the Out Message

Image
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"/>
2).
<header expression="xpath-expression" name="Action"/>
More Info: Header Mediator
TCPMon:

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 -DgroupId=com.oracle -DartifactId=ojdbc14 -Dversion=11.2.0.3.0 -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 …