Notification Service Example: Mail

Description

This example shows the use of the Notification Service configured with a Push Supplier object connected to an event channel that sends events, and a Pull Consumer object connected to the same event channel that receives events. The consumer-side proxy has a filter applied that only allows events destined to be received by the given Consumer to be delivered.

Synopsis

This example includes a client/server program that allows the creation of mailbox accounts identified by a given user name. Users can then login to given mailbox accounts to send and/or receive text-messages to/from other mailbox accounts.

Design

The example uses a single event channel and the following classes:

When the mailbox is launched, the initialisation process will use an existing Notification Service event channel with id 0 (zero) if one is available, otherwise it will create a new event channel.

The following commands control the mailbox example:

How to Build This Example

UNIX

These instructions are based on the Solaris gcc3.2 compiler makefiles.

  1. Ensure that the following environment variables are set:
  2. Ensure that your environment is set up for your compiler and linker. For example, for gcc3.2:

    PATH=/usr/local/gcc-3.2/bin:/usr/ccs/bin:$PATH; export PATH

    LD_LIBRARY_PATH=/usr/local/gcc-3.2/lib:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH

  3. Change to the <TAO install dir>/examples/cc directory.
  4. If you have not done so already, enter the make command to run the makefile. This will compile all of the OpenFusion examples.

Windows NT

  1. Set the environmental property TAO_ROOT=<TAO install dir>, where <TAO install dir> is the location into which you have installed TAO.
  2. A global example Microsoft Visual C++ project has been provided. This is called <TAO install dir>\examples\cc\cc.dsw. Double-click on the project file to load it into Microsoft Visual C++. When loaded, change the Common project from debug mode to release mode using the Build | Set Active Configuration menu option.
  3. Build the Common files.
  4. Build the NotificationMailExample files.
  5. Build the Mail files.

How to Run This Example

UNIX: Ensure that the environment variable LD_LIBRARY_PATH includes the path to where the common files and the video files were compiled:

LD_LIBRARY_PATH=<TAO install dir>/examples/cc/Common:<TAO install dir>/examples/cc/Notification/mail:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH

Windows NT: Start a DOS window. Ensure that your path contains:

<TAO install dir>\bin;<TAO install dir>\examples\cc\bin

  • Ensure that the Notification Service is running. In order to run the OpenFusion Notification Service you must first install the OpenFusion TCS - JacORB with OpenFusion CORBA Services distribution. This can be obtained from the downloads page by following the OpenFusion CORBA Products software link.

  • Start two mail clients and servers in separate windows:

    Windows NT:

    mail -ORBInitRef NotificationService=file://<OF_INSTALL_DIR>/domains/OpenFusion/localhost/NotificationService/NotificationSingleton/NotificationSingleton.ior

    This will reply with the prompt ADMIN>.

    UNIX: Change to the <TAO install dir>/examples/cc/Notification/mail directory.

    ./mail -ORBInitRef NotificationService=file://<OF_INSTALL_DIR>/domains/OpenFusion/localhost/NotificationService/NotificationSingleton/NotificationSingleton.ior

    This will reply with the prompt ADMIN>

  • Create a mailbox with the command:
    create mailbox1
  • In the other process, window create a mailbox with the command:
    create mailbox2
  • Login to each respective mailbox using the commands:
    login mailbox1

    and

    login mailbox2

    The command-line prompt will change to indicate the name of the logged-in account.

  • When logged in to mailbox1, send a text message to mailbox2 using the command:
    send mailbox2 hello from mailbox1
  • From the mailbox2 session, use the command:
    receive

    This should pull events from the Notification Service event channel and receive the text message sent from mailbox1.

  • top
    [top]


    © PrismTech Limited 2002