Monday, July 13, 2009

A Simple Savan Enabled Publish-Subscribe Environment


This is a guide to create a simple publisher subscriber service environment using Apache Savan.

Step 1 : Setting up the environment
Before being able to run this example you need to do some steps to configure the environment. They are...
  • Setup Java
  • Install Apache Axis 2
  • Install Maven
  • Install Apache Ant
Please check here to get more information about these steps.

Step 2 : Build the sources
Download the source code from here.
Extract it.
Go to the \Savan\Savan Source folder using the command prompt.
Execute the following command. (mvn clean install)
Wait until all the sources are built successfully.
Go to the \Savan\Savan Source\modules\samples\eventing folder using the command prompt.
Execute the following command. (ant deploy)
Go to your AXIS2_HOME\lib folder.
Copy all the files in the AXIS2_HOME\lib folder to the \Savan\SavanTester\lib folder.

Step 3 : Configure the example
Open the \Savan\SavanTester\configuration.xml file.
Do the following changes.
Enter the IP adress of the Axis2 server, at the "serverIP" entry. (for localhost enter 127.0.0.1)
Enter the port number of the Axis2 server, at the "port" entry. (most of the time this is 8080)
Enter the path to the axis2.xml file in the AXIS2_HOME\conf folder, at the "conf" entry. (e.g. C:\axis2-1.4\conf\axis2.xml)
Enter the path to the repository folder in the AXIS2_HOME directory, at the "repo" entry. (e.g. C:\axis2-1.4\repository)

Step 4 : Run the example
Start the Axis2 server. For this go to the \AXIS2_HOME\axis2-1.4\bin folder using the command prompt and execute the following command. (axis2server.bat)
Run the SavanTester.jar file in the \Savan\SavanTester folder.
You will see the following screen.

Step 5 : Using the application
Start playing with it.
There are three publishers and three subscribers.
Use the buttons in the middle to subscribe or unsubscribe from any service.
After you have subscribed to some services you can fire a publishing event using the buttons on the top.
Keep your eye on the Axis2 console for information regarding subscriptions.
Enjoy.