Published on WSO2 Oxygen Tank (http://wso2.org)

Axis2 Event Generation and Notification

By deepal
Created 2008-02-13 21:27

Whenever changes occur to a Web service or a module, Axis2 will generate an event. Events generation occurs for the following scenarios:

 

Applies To

Project: Axis2 java any version
Environment: Any OS

Depending on the type of event, a system administrator could perform some action. Say for example, whenever someone deploys a Web service to the system that administrator wants to be informed of, he could register an event listener to listen on events and notify him about that event. It could even be, a listener sending an email to the administrator. This kind of event generation and notification can be used as value addition for a Web service framework or a Web Service server.

A good example can be found in WSO2 WSAS. It has the ability to generate Atom and RSS feeds, representing service and module status and history. This way, whenever a service or module in WSAS is deployed, it would generate a Atom and RSS feed. Additionally, when a service is removed or someone performs service update, it would still generate a RSS and Atom feed. One can use these feeds to access past activities of a given service or a module.

Registering an event listener is very simple and straightforward. First you need to write a class implementing “org.apache.axis2.engine.AxisObserver”. Interface looks like what's given below:

 

public interface AxisObserver extends ParameterInclude

{

void init(AxisConfiguration axisConfig);

void serviceUpdate(AxisEvent event, AxisService service);

void serviceGroupUpdate(AxisEvent event, AxisServiceGroup serviceGroup);

void moduleUpdate(AxisEvent event, AxisModule module);

}

 

Author:

Deepal Jayasinghe, Teachnical Lead , WSO2 Inc, deepal AT wso2 dot com

 


Source URL:
http://wso2.org/library/3225