To provide asynchronous message notification, implement and install a message listener on a message queue. A message listener can be either:
An EJB 2.0 message-driven bean (MDB) that implements the javax.jms.MessageListener interface, or
An EAServer class that implements the CtsComponents::MessageListener interface; this is called an EAServer message listener.
For information on how to implement, install, and configure an MDB, see Chapter 31, “Using the Message Service,” in the EAServer Programmer’s Guide.
Installing
an EAServer message listener
To install a listener on an active queue, select Active Queues; to install a listener on an inactive queue, select Configured Queues.
Select a message queue from the list, and select File | Properties.
In the Queue Properties dialog box, select the Listeners tab.
Click Add.
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.
A 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.
Click OK.
Before you install the message listener component, configure it to support the MessageListener interface.
Configuring a component to support the CtsComponents::MessageListener
interface
Select EAServer | Installed Packages | package_name | component_name, where package_name/component_name is the name of an installed message listener.
Under the component, select Interfaces. Right-click and select Add Interfaces. This displays the Install Interfaces dialog box.
In the Available IDL Interfaces drop-down list, select CtsComponents. This displays the list of CtsComponents interfaces.
Select CtsComponents::MessageListener, and click Add. This moves the interface name to the Selected to Install list.
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 { ... } };
Deleting an EAServer message listener
To delete a listener from a message queue, select either Active Queues or Configured Queues.
Select a message queue from the list, and select File | Properties.
In the Properties dialog box, select the Listeners tab.
Choose a listener from the list and click Delete.
Copyright © 2005. Sybase Inc. All rights reserved. |
![]() |