Channel Example Introduction

The ActiveSpaces Transactions Channel framework is an adapter layer that makes the ActiveSpaces Transactions administrative and event-logging frameworks available for use by a pure Java connectivity layer.

This project shows an example of integrating an existing network connectivity component (Apache Mina) with the ActiveSpaces Transactions Channel framework.

Please see the enclosed source, javadoc, example class descriptions, and channel development how-to.


The example implements a very simple TCP server.

The Main class creates and starts a Service instance on a given port. The Service internally owns a Listener that wraps the acceptor and port binding.

As a new Session is started on the Service, a brief welcome message will be displayed. The first message received on the session will be taken as the session name. Once the session name is received, a Endpoint instance is created to manage the session.

As messages are received on sessions, they are forwarded to the Application which broadcasts the message to all connected sessions.

The protocol is text, with messages separated by newlines.

To start the server at port 6060 on the ActiveSpaces Transactions Development Appliance:

NOTE: kabira-server.local only works if service discovery is being used on the client. Otherwise use the IP address of the ActiveSpaces Transactions Development Appliance.

mvn -Dcom.kabira.fluency.administrationPort=2000 \
      -Dcom.kabira.fluency.hostName=kabira-server.local \
      compile deploy:exec

The server will display:

MINA-based chat server started at port 6060.
To stop this application, stop the JVM

At this point, you can connect with any network client (telnet, mconnect, netcat, etc.). Here is an example execution, connecting to port 6060:

> telnet 10.170.... 6060
Escape character is '^]'.
Welcome! At any time, type "quit" to exit.
Please type an identifier to continue:
[ (Thu Feb 25 14:53:08 PST 2010 on A) Tester]: [Tester] logged in.
[ (Thu Feb 25 14:53:17 PST 2010 on primary) Tester]: Hello?
[ (Thu Feb 25 14:53:44 PST 2010 on primary) Replyer]: [Replyer] logged in.
[ (Thu Feb 25 14:53:48 PST 2010 on primary) Replyer]: Hello!
[ (Thu Feb 25 14:53:50 PST 2010 on primary) Replyer]: [Replyer] logged off.

In the following ActiveSpaces Transactions Administrator view, the "chat" Service is selected. The Endpoints created by four chat clients are attached to the "chat" Service.

View of the "chat" Service in ActiveSpaces Transactions Administrator

To shut down the application, stop the "chat" service via the ActiveSpaces Transactions Administrator, using the "stop" button.

Each Endpoint is created with a Session instance to manage session-level statistics and wrap access to the Mina Session Handler:

View of the "Tester" Endpoint in ActiveSpaces Transactions Administrator

Select the named Session instance will show the details for that instance:

View of the "Tester:primary" Endpoint in ActiveSpaces Transactions Administrator


See the Dependencies page for information on the example's dependencies.

For each dependency listed in the Project Dependencies section of the Dependencies page, the example's POM (or parent POM) defines a property specifying the version of the dependency used by the example. These properties can be overridden if there is a need to change the dependency versions used by the example. The names of these properties are of the form com.tibco.groupId.artifactId.version where groupId and artifactId are the group id and artifact id of the dependency. For example, the property named specifies the version of the dependency with the group id of com.tibco and the artifact id of ast.