Thursday, September 30, 2010

Build WSO2 Stratos ESB from source

Following blogpost will discuss how to build WSO2's Stratos ESB (aka Cloud ESB) from source.

1. First build carbon trunk upto features. Please follow my earlier post on building WSO2 ESB from source.

2. Checkout WSO2 Stratos source.

svn co https://svn.wso2.org/repos/wso2/trunk/stratos

Then following directories/files will be checked into your file system.

.
|-- build
|-- components
|-- features
|-- pom.xml
|-- samples
|-- services
`-- setup

3. Build Stratos components project.

heshan@heshan-laptop:~/Dev/trunk/stratos/components$ mvn clean install -Dmaven.test.skip=true

4. Build Strtos features project.

heshan@heshan-laptop:~/Dev/trunk/stratos/features$ mvn clean install -Dmaven.test.skip=true

5. Build Stratos Manager.

heshan@heshan-laptop:~/Dev/trunk/stratos/services/manager$ mvn clean install -Dmaven.test.skip=true

6. Build Stratos ESB.

heshan@heshan-laptop:~/Dev/trunk/stratos/services/esb$ mvn clean install -Dmaven.test.skip=true

7. Run the setup script.

heshan@heshan-laptop:~/Dev/trunk/stratos/setup$ ./setup.sh

8. Create the necessary databases.

mysql>CREATE DATABASE stratos_db;

mysql>CREATE DATABASE WSO2CARBON_DB;

mysql>CREATE DATABASE billing;

Create users and give necessary user-permssions.

mysql>CREATE USER 'wso2stratos'@'localhost' IDENTIFIED BY 'wso2stratos';
mysql>GRANT ALL ON *.* TO 'wso2stratos'@'localhost';

mysql>CREATE USER 'billing'@'localhost' IDENTIFIED BY 'billing';
mysql>GRANT ALL ON *.* TO 'billing'@'localhost';

Create tables.

heshan@heshan-laptop:~/Dev/trunk/stratos/services/manager/modules/distribution/target/wso2stratos-manager-1.0.0-SNAPSHOT/dbscripts$ mysql -u root -p < billing-mysql.sql billing

9. Start the Stratos Manager.
NOTE: Server should be started with -Dsetup option in the first time.

heshan@heshan-laptop:~/Dev/trunk/stratos/services/manager/modules/distribution/target/wso2stratos-manager-1.0.0-SNAPSHOT/bin$ ./wso2server.sh -Dsetup

10. Start Stratos ESB.
NOTE: Server should be started with -Dsetup option in the first time.

heshan@heshan-laptop:~/Dev/trunk/stratos/services/esb/modules/distribution/target/wso2stratos-esb-1.0.0-SNAPSHOT/bin$ ./wso2server.sh -Dsetup

11. Stop the above servers. Then startup the both the servers again without -Dsetup option.

heshan@heshan-laptop:~/Dev/trunk/stratos/services/manager/modules/distribution/target/wso2stratos-manager-1.0.0-SNAPSHOT/bin$ ./wso2server.sh
heshan@heshan-laptop:~/Dev/trunk/stratos/services/esb/modules/distribution/target/wso2stratos-esb-1.0.0-SNAPSHOT/bin$ ./wso2server.sh

12. Create a Tenent by logging into the Stratos Manager. Then using the credentials obtained, you can log into the Stratos ESB.

Friday, September 10, 2010

Migrate Synapse Configuration from 1.2 to 2.0

The current namespace of the synapse-2.0 trunk is http://synapse.apache.org/ns/2010/04/configuration. The earlier namespace of synapse-1.2 was http://ws.apache.org/ns/synapse. Therefore you may encounter some errors, when running a synapse configuration of a 1.2 release against a trunk build(ie. synapse-2.0.0-SNAPSHOT). Since the Synapse configuration has undergone some configuration changes, merely changing the namespace of the the old synapse configuration wont help you to solve your problem.

That's why Synapse ships a migration tool for migrating a 1.2 configuration to a 2.0 configuration. Ruwan has written the xslt transformation for the above. You can find it in the Synapse trunk.

Recently I had to update the Synapse sample configurations of WSO2 ESB's trunk. This tool made my life a lot easier during the migration process. I modified the sample migrator to suit my purpose. I am sharing the code here, if you need to migrate the synapse configurations in bulk.

import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

/**
*
*/
public class ConfigurationMigrator {

private static final String MIGRATOR_XSLT_PATH
= "modules/migrator/src/main/resources/synapse-configuration-migrator.xslt";

public static int confgNumber [] = new int []
{0,1,2,3,4,5,6,7,8,9,10,11,
50,51,52,53,54,55,56,57,58,
100,101,102,
150,151,152,153,154,155,
200,201,202,
250,251,252,253,254,255,256,257,258,259,
260,261,262,264,265,
300,
350,351,352,353,354,
360,361,362,363,
370,371,372,
380,381,
390,391,
400,420,430,
500,501,502,503,504,
550,551,
600,601,602,603,604,605,606,
652,654};

public static void doTransform(String xmlFile, String xslFile, String outFile)
throws TransformerException, IOException {

FileReader xslFileReader = new FileReader(xslFile);
StreamSource xslStreamSource = new StreamSource(xslFileReader);

FileReader xmlFileReader = new FileReader(xmlFile);
StreamSource xmlStreamSource = new StreamSource(xmlFileReader);

FileWriter outFileWriter = new FileWriter(outFile);
StreamResult outStreamResult = new StreamResult(outFileWriter);

TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer(xslStreamSource);

transformer.transform(xmlStreamSource, outStreamResult);
outFileWriter.flush();
}

public static void migrateAllConfigs(String source, String destination){
System.out.println("\n\t#######################################################");
System.out.println("\t# Apache Synapse - Configuration Migration #");
System.out.println("\t#######################################################");

System.out.println("\n[INFO] Migration STARTED");

for (int aConfgNumber : confgNumber) {
try {
System.out.println("[INFO]Migrating synapse configuration : " + aConfgNumber);
doTransform(source + aConfgNumber + ".xml", MIGRATOR_XSLT_PATH, destination + aConfgNumber +".xml");

} catch (TransformerException e) {
handleException("Migration FAILED\n\t" + e.toString());
} catch (IOException e) {
handleException("Migration FAILED\n\t" + e.toString());
}
}

System.out.println("[INFO] Migration COMPLETED");

}

public static void main(String args[]) {
migrateAllConfigs("/home/heshan/Dev/trunk/carbon/products/esb/modules/samples/src/main/conf/synapse/synapse_sample_",
"/tmp/synapse-config/synapse_sample_");
}

private static void handleException(String message) {
System.out.println("[ERROR] " + message);
}
}

Thursday, September 9, 2010

WSO2 Enterprise Service Bus (ESB) 3.0.1 Released

The WSO2 ESB team is pleased to announce the release of version 3.0.1 of the Open Source Enterprise Service Bus (ESB).

WSO2 ESB is a fast, lightweight and user friendly open source Enterprise Service Bus (ESB) distributed under the Apache Software License v2.0. WSO2 ESB allows system administrators and developers to easily configure message routing, intermediation, transformation, logging, task scheduling, fail over routing and load balancing. It also supports transport switching, eventing, rule based mediation and priority based mediation for advanced integration requirements. The ESB runtime is designed to be completely asynchronous, non-blocking and streaming based on the Apache Synapse mediation engine.

WSO2 ESB 3.0.1 is developed on top of the revolutionary WSO2 Carbon platform (Middleware a' la carte), an OSGi based framework that provides seamless modularity to your SOA via componentization. This release also contains many new features and a range of optional components (add-ons) that can be installed to customize the behavior of the ESB. Further, any existing features of the ESB which are not required to your environment can be easily removed using the underlying provisioning framework of Carbon. In brief, WSO2 ESB can be fully customized and tailored to meet your exact SOA needs.

You can download this distribution from http://wso2.org/downloads/esb and give it a try.

How to Run

  1. Extract the downloaded zip
  2. Go to the bin directory in the extracted folder
  3. Run the wso2server.sh or wso2server.bat as appropriate
  4. Point your browser to the URL https://localhost:9443/carbon
  5. Use "admin", "admin" as the username and password to login as an admin and create a user account
  6. Assign the required permissions to the user through a role
  7. If you need to start the OSGi console with the server use the property -DosgiConsole when starting the server. The INSTALL.txt file found on the installation directory will give you a comprehensive set of options and properties that can be passed into the startup script
  8. Sample configurations can be started by the wso2esb-samples script passing the sample number with the -sn option (Please have a look at the samples guide for more information, on running samples)

New Features of WSO2 ESB 3.0.1

There are no new features in this release. This is a bug fix release. See the section "Bugs Fixed in WSO2 ESB 3.0.1" for more information.

Key Features of WSO2 ESB

  • Proxy services - facilitating synchronous/asynchronous transport, interface (WSDL/Schema/Policy), message format (SOAP 1.1/1.2, POX/REST, Text, Binary), QoS (WS-Addressing/WS-Security/WS-RM) and optimization switching (MTOM/SwA).
  • Non-blocking HTTP/S transports based on Apache HttpCore-NIO for ultrafast execution and support for thousands of connections at high concurreny with constant memory usage.
  • Built in Registry/Repository, facilitating dynamic updating and reloading of the configuration and associated resources (e.g. XSLTs, XSD, WSDL, Policies, JS configurations ..)
  • Easily extendable via custom Java classes (mediator and command)/Spring configurations, or BSF Scripting languages (Javascript, Ruby, Groovy, etc.)
  • Built in support for scheduling tasks using the Quartz scheduler.
  • Load-balancing (with or without sticky sessions)/Fail-over, and clustered Throttling and Caching support
  • WS-Security, WS-Reliable Messaging, Caching & Throttling configurable via (message/operation/service level) WS-Policies
  • Lightweight, XML and Web services centric messaging model
  • Support for industrial standards (Hessian binary web service protocol/ Financial Information eXchange protocol and optional Health Level-7 protocol)
  • Enhanced support for the VFS (File/FTP/SFTP), JMS, Mail transports with optional TCP/UDP transports and transport switching among any of the above transports
  • Support for message splitting & aggregation using the EIP and service callouts
  • Database lookup & store support with DBMediators with reusable database connection pools
  • WS-Eventing support with event sources and event brokering
  • Rule based mediation of the messages using the Drools rule engine
  • Transactions support via the JMS transport and Transaction mediator for database mediators
  • Internationalized GUI management console with user management for configuration development
  • Integrated monitoring support with statistics, configurable logging and tracing
  • JMX monitoring support and JMX management capabilities like, Graceful/Forceful shutdown/restart

Bugs Fixed in This Release

This release of WSO2 ESB comes with a number of bug fixes, both in the base framework and the ESB specific componenents. All the issues which have been fixed in ESB 3.0.1 are recorded at following locations:

Known Issues

  • Endpoint UI does not support selecting already existing endpoints as child endpoints when creating load balance/failover endpoints
  • HTTP GET requests performed on an endpoint that has a trailing '/' character, do not work properly
  • SOAP tracer does not work when the message relay is activated
  • The sequence editor and the built-in XML editors do not work properly on Google Chrome

All the open issues pertaining to WSO2 ESB 3.0 are reported at following locations:

How You Can Contribute

Mailing Lists

Join our mailing list and correspond with the developers directly.

Reporting Issues

WSO2 encourages you to report issues and your enhancement requests for the WSO2 ESB using the public JIRA.

You can also watch how they are resolved, and comment on the progress..

Discussion Forums

Alternatively, questions could be raised using the forums available.

WSO2 ESB Forum : Discussion forum for WSO2 ESB developers/users

Support

We are committed to ensuring that your enterprise middleware deployment is completely supported from evaluation to production. Our unique approach ensures that all support leverages our open development methodology and is provided by the very same engineers who build the technology.

For more details and to take advantage of this unique opportunity please visit http://wso2.com/support.

For more information about WSO2 ESB please see http://wso2.com/products/enterprise-service-bus.

-- The WSO2 ESB Team --

Thursday, September 2, 2010

Win a free trip to WSO2 Con

The sponsorship includes:

* Return air ticket, including international!
* 5 nights hotel accommodation
* Ground transport
* US $50 per Diem
* Free pass to WSO2Con 2010
* Free pass to two day special Technical Workshop
* Invitation to VIP Gala Dinner Celebration
* Invitation to WSO2 5 Year Celebration Party

For more information visit [1].

[1] - http://wso2.org/wso2con2010-sponsorship

Wednesday, September 1, 2010

WSO2 Con 2010

WSO2 Con 2010 will be held at HNB Towers, Colombo on 14th and 15th September. For more information visit WSO2Con website.