Sun Java System Messaging Server 6.3 Administration Guide

Appendix B Administering Event Notification Service in Messaging Server

This appendix describes what you need to do to enable the Event Notification Service Publisher (ENS Publisher) and administer Event Notification Service (ENS) in Messaging Server.

This chapter/appendix contains these sections:

For more information on ENS and ENS APIs, see the Sun Java Communications Suite 5 Event Notification Service Guide.

B.1 Loading the ENS Publisher in Messaging Server

The Event Notification Service (ENS) is the underlying publish-and-subscribe service. ENS acts as a dispatcher used by Sun Java System applications as a central point of collection for certain types of events that are of interest to them. Events are changes to the value of one or more properties of a resource. Any application that wants to know when these types of events occur registers with ENS, which identifies events in order and matches notifications with subscriptions.

ENS and iBiff (the ENS publisher for Messaging Server) are bundled starting with Messaging Server. By default ENS is enabled, however, iBIFF is not loaded. (See B.1 Loading the ENS Publisher in Messaging Server.

In order to subscribe to notifications in Messaging Server, you need to load the libibiff file on the Messaging Server host then stop and restart the messaging server.

ProcedureTo Load the ENS Publisher on Messaging Server

Perform the following steps from the command line. In these steps, the location of the Messaging Server installation directory is msg-svr-base, and the Messaging Server user is inetuser. Typical values for these variables are /opt/SUNWmsgsr, and mailsrv, respectively.

  1. As mailsrv, run the configutil utility to load the libibiff file.


    cd msg-svr-base
    ./configutil -o "local.store.notifyplugin" -v "msg-svr-base/lib/libibiff"
    
  2. As root, stop then restart the messaging server.

    cd msg-svr-base/sbin

    ./stop-msg

    ./start-msg

  3. You are now ready to receive notifications through ENS. See B.2 Running Sample Event Notification Service Programs

B.2 Running Sample Event Notification Service Programs

Messaging Server contains sample programs to help you learn how to receive notifications. These sample programs are located in the msg-svr-base/examples directory.

ProcedureTo Run the Sample ENS Programs

  1. Change to the msg-svr-base/examples directory.

  2. Using a C compiler, compile the apub and asub examples using the Makefile.sample file. Set your library search path to include the msg-svr-base/examples directory.

  3. Once the programs have been compiled, you can run them as follows in separate windows:

    apub localhost 7997

    asub localhost 7997

    Whatever is typed in the apub window should appear on the asub window. Also, if you use the default settings, all iBiff notifications should appear in the asub window.

  4. To receive notifications published by iBiff, write a program similar to asub.c

    For more information on the sample programs, and writing your own programs for ENS, see the Sun Java Communications Suite 5 Event Notification Service Guide.


    Note –

    Once you set your library search path to include the msg-svr-base/lib directory, you can no longer stop and start the directory server. The workaround is to remove the entry from the library search path.


B.3 Administering Event Notification Service

Administering ENS consists of starting and stopping the service, and changing the configuration parameters to control the behavior of the iBiff publisher for ENS.

B.3.1 Starting and Stopping ENS

You use the start-msg ens and stop-message ens commands to start and stop the ENS server. You must be root to run these commands.

ProcedureTo Start and Stop ENS

  1. To start ENS:

    msg-svr-base/sbin/start-msg ens

    • To stop ENS:

      msg-svr-base/sbin/stop-msg ens

B.3.2 Event Notification Service Configuration Parameters

Several configuration parameters control the behavior of iBiff. Use the configutil utility program to set these parameters.

Table B–1 iBiff Configuration Parameters

Parameter  

Description  

local.store.notifyplugin.maxHeaderSize

Specifies the maximum size (in bytes) of the header that will be transmitted with the notification. The default is 0 bytes. 

local.store.notifyplugin.maxBodySize

Specifies the maximum size (in bytes) of the body that will be transmitted with the notification. The default is 0 bytes. 

local.store.notifyplugin.eventType.enable

Specifies if the given event type will generate a notification. The legal values are 1 (to enable) and 0 (to disable). The default value is 1; that is, setting local.store.notifyplugin.ReadMsg.enable to 0 will disable ReadMsg notifications.

local.store.notifyplugin.ensHost

Specifies the hostname of the ENS server. The default is 127.0.0.1.

local.store.notifyplugin.ensPort

Specifies the TCP port of the ENS server. The default is 7997.

local.store.notifyplugin.ensEventKey

Specifies the event key to use for ENS notifications. The default is enp://127.0.0.1/store. The hostname portion of the event key is not used to determine the ENS host. It is simply a unique identifier used by ENS.

This key is what the subscriber should subscribe to in order to be notified of events matching this key.