Listeners

To provide asynchronous message notification, implement and install a message listener on a message queue. A message listener can be either:

For information on how to implement, install, and configure an MDB, see Chapter 31, “Using the Message Service,” in the EAServer Programmer’s Guide.

StepsInstalling an EAServer message listener

  1. To install a listener on an active queue, select Active Queues; to install a listener on an inactive queue, select Configured Queues.

  2. Select a message queue from the list, and select File | Properties.

  3. In the Queue Properties dialog box, select the Listeners tab.

  4. Click Add.

  5. In the New Listener dialog box, enter a listener (component) that has been installed in EAServer. Use this format:

    package_name/component_name[threadpool_name]
    

    where package_name is the package name, component_name is the component name, and threadpool_name is an optional thread pool name. You can create thread pools in EAServer Manager as described in “Thread pools”. The thread pool must have one or more worker threads.

    NoteA thread pool with multiple worker threads enables the message listener to process multiple messages at the same time.

    If you do not specify the name of a thread pool, the message listener uses the <system> default thread pool, which has a single worker thread.

  6. Click OK.

Before you install the message listener component, configure it to support the MessageListener interface.

StepsConfiguring a component to support the CtsComponents::MessageListener interface

  1. Select EAServer | Installed Packages | package_name | component_name, where package_name/component_name is the name of an installed message listener.

  2. Under the component, select Interfaces. Right-click and select Add Interfaces. This displays the Install Interfaces dialog box.

  3. In the Available IDL Interfaces drop-down list, select CtsComponents. This displays the list of CtsComponents interfaces.

  4. Select CtsComponents::MessageListener, and click Add. This moves the interface name to the Selected to Install list.

  5. Click Install.

Alternately, you can use the IDL editor and modify your component’s existing interface to inherit from CtsComponents::MessageListener; for example:

module msglistener
{
  interface Receiver : ::CtsComponents::MessageListener
  {
    ...
  }
};

StepsDeleting an EAServer message listener

  1. To delete a listener from a message queue, select either Active Queues or Configured Queues.

  2. Select a message queue from the list, and select File | Properties.

  3. In the Properties dialog box, select the Listeners tab.

  4. Choose a listener from the list and click Delete.