Chat Service Application Example Introduction

This project is an example of a simple ActiveSpaces Transactions application. This application uses the Chat Server channel example and the ActiveSpaces Transactions Business State Machine Framework to implement a highly available distributed Chat Service.

The ActiveSpaces Transactions Business State Machine framework provides highly available processing of requests that are modeled using state machines. An instance of a state machine is called a busines process.

While the Chat Service application is simple, the architectural approach used is common to most ActiveSpaces Transactions applications.

Please see source, javadoc, example class descriptions, and application development how-to.

Usage

The Chat Service application can be started on one or more nodes.

The Chat Service Application supports the following commands:

  • TALK user name message - send message to user
  • LIST - list all active users
  • REMOVE user name - remove user from chat server (administrators only)

To start the Chat Service Application on all nodes on the ActiveSpaces Transactions Development Appliance:

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

The application will display the following when it has completed initialization on all nodes. The port numbers are needed to connect to the individual nodes.

[B] ==============================================
[B] Chat listener started at port 41098.
[B] ==============================================
[B] ==============================================
[B] Chat application started.
[B] To stop this application, stop the JVM running the application.
[B] ==============================================
[C] ==============================================
[C] Chat listener started at port 54665.
[C] ==============================================
[C] ==============================================
[C] Chat application started.
[C] To stop this application, stop the JVM running the application.
[C] ==============================================
[A] ==============================================
[A] Chat listener started at port 45481.
[A] ==============================================
[A] ==============================================
[A] Chat application started.
[A] To stop this application, stop the JVM running the application.
[A] ==============================================

At this point, you can connect with any network client (telnet, mconnect, netcat, etc.). Here is an example execution, connecting to the A node using port 45481

telnet kabira-server.local 45481
Trying 172.16.208.129...
Connected to kabira-server.local.
Escape character is '^]'.
Welcome! At any time, type "quit" to exit.
Please type an identifier to continue:
Dan

Welcome Dan
help

TALK <user name> <message> - send message to user
LIST - list all active users
list

        Name: Dan
        State: ONLINE
        Number of Commands: 3
        Administrator: false
        Process: 781714:2372672:12972136701:1
        Created: Sat Jun 25 07:41:38 PDT 2011
        Last Login: Sat Jun 25 07:41:38 PDT 2011
        Last Logout: Not Available
        Home Node: B
        Active Node: B
        Partition Name: Y
        Connected at Node: B
quit
Connection closed by foreign host.

In the following ActiveSpaces Transactions Administrator view, the JVM running the Chat Service Application is displayed.

Chat Service Application JVM.

To shut down the application, stop the Chat Service JVM using the Stop button.

Every user has an associated endpoint. The name of the endpoint is the name of the identifier specified when then user connects. If the user is connected, there is also a session associated with the endpoint.

"Tester" Endpoint.

When a user is connected a business process is associated with the user. Business processes can be displayed in the Business State Machines tab in the node display.

Business processes.

The Chat Service application configuration has a type of "chat". The default configuration can be displayed by navigating to configuration in the Domain Browser.

Chat configuration.

The high availability partitions defined in the default configuration can be displayed by selecting High Availabilty Partitions in ActiveSpaces Transactions Administrator.

Chat high availability partitions.

Dependencies

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 com.tibco.com.tibco.ast.version specifies the version of the dependency with the group id of com.tibco and the artifact id of ast.