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

Web Services Eventing Solution with Apache Savan/C - Part2

By damitha
Created 2008-02-11 03:46

The Axis2/C Web services platform is a great platform for developing Web services. One of the modules that is a part of this platform is Apache Savan/C, a WS-Eventing implementation module. The purpose of this article is to discuss how this platform was used in one of my client projects, which required an eventing solution as a component. This article by Damitha Kumarage, he discusses this eventing solution in addition to providing valuable information for those planning on hosting their services with Apache Axis2/C.

Part I of this tutorial that discusses the same concepts can be found here [1].

 

Applies To

Apache Axis2/C 1.1.0 - 1.2.0
WSF/C 1.1.0 - 1.2.0
Apache Savan/C 0.90
Environment Linux - Debian Etch/Lenny, Ubuntu, Fedora

 

Table of Contents

 

JMS Queue [3] as the data sink.

Adaptors that I have implemented are specialized for individual data sources. They all implement the service API provided by Apache Axis2/C. Some of my adaptors publish the data it receives, periodically,  in accordance to a real time clock. Some of these adaptor services starts functioning, as soon as they are loaded for service, while Some start functioning from the first request being initiated for the service.

One such data source is the syslogd daemon. My Syslog Adaptor, [4] when loading, opens a socket for listening to syslogd logging messages. When message lines are received, the adaptor parses it and builds an XML entry of it, which it then sends to the corresponding Stream Handler [5].

Other data sources include messages from a chat room, configured in a XMPP server. My Monitor Adaptor [6] receives such messages and transmits them to the corresponding Stream Handler.

End to end flow [7]

 

End to End Flow

Now let's take a look at some of the implementation details:

 

How to Use WSO2 WSF/C, XMPP Transport [7].

-notify is the operation that will be invoked, when an xmpp presence event is received from the xmpp server chat room.

-xmpp_subscribe_to is the chat room id of the xmpp service to which the monitor adaptor will subscribe, for the purpose of receiving chat room presence events.

-xmpp_subscribe_type is the subscriber type. We use the type user.

Our xmpp server requires kerberos authenticaton to connect with. The following script was installed into /etc/init.d of the monitor adaptor during deployment for the job.

# /etc/init.d/monitor

### BEGIN INIT INFO
# Provides: monitor
# Required-Start: $network
# Should-Start: $named
### END INIT INFO

. /etc/rc.status

rc_reset

case "$1" in
  start)
    echo -n "Kiniting for monitor."
        kinit -k -t /etc/opt/wsfes-ml/monitor.keytab monitor/monitor@VSS.MLRND.COM -c /tmp/monitor

    rc_status -v
    ;;
  stop)
    echo -n "removing monitor ticket"
    rc_status -v
    ;;
  reload)
        ;;
  restart|force-reload)
        $0 stop
        $0 start
        rc_status
        ;;
  *)
    echo "Usage: $0 {start}" >&2
    exit 1
    ;;
esac

exit 0
 

stomp [8] protocol to communicate with the JMS Queue.

 

Apache Module [9]. Subscription Manager is deployed in a simple Axis2 server and listens on a TCP port. Actually, at a latter phase of the project, subscription manager was moved to the same server as adaptors and stream handlers. However, whether they are on the same server, or otherwise, adaptors and subscription Manager had to communicate using SOAP protocol. It would have been nice if Axis2/C had an internal protocol to communicate, for communications within the same server. (i.e. from the transport layer, the engine need to be able to determine if communication is within the same server or not. If it is within the same server, then the engine should be able to transparently communicate within the server, instead of SOAP as it helps alleviating the overhead inherent in serialization/deserialization of SOAP messages).

 

Web Services Eventing with Apache Savan/C - Part 1 [9]
  • WSO2 WSF/C [9]- WSO2 WSF/C is an Open Source framework for providing and consuming Web services
  • Savan/C [10]- Savan/C is an implementation of Web Services Eventing Specification
  • C client to communicate with [11]ActiveMQ [12]
  • Axis2/C XMPP Transport [13]
  • How to configure a JMS Topic Endpoint [13]
  •  

    Author

    Damitha Kumarage, Senior Software Engineer at wso2, committer Apache Software Foundation, damitha at wso2 dot com


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