Public Member Functions

cern.cmw.mom.pubsub.Subscriber Interface Reference

Inheritance diagram for cern.cmw.mom.pubsub.Subscriber:
cern.cmw.mom.pubsub.impl.DefaultSubscriberImpl

List of all members.

Public Member Functions

void setExceptionListener (ExceptionListener listener)
void close ()
long subscribe (String topic, SubscriptionListener listener, String selector) throws JMSException, NamingException
void unSubscribe (long subscriptionToken) throws JMSException
void unSubscribeAll () throws JMSException

Detailed Description

Public interface. Provide topic subscription facilities.

Two kinds of exception are thrown :

This example shows a simple subscription to a topic:

<blockquote>

 try {
   s = PubSubFactory.subscriber();
 } catch (MOMException momEx) { ... }
 try {
   subToken = s.subscribe("CMW.DEVICES.PowerConverter.PC1.Current", listener, selector);
   // ...
   s.unSubscribe(subToken);
   s.close();
 }
 catch (JMSException jmsEx) { ... }
 catch (NamingException namingEx) { ... }
 </blockquote>

where listener is an instance of a class implementing the SubscriptionListener interface method void onMessage(Message m) and selector is an optional String defining a message selector.

See also:
Publisher
SubscriptionListener
PubSubFactory
NotificationHelper
cern.cmw.mom.mapping.MappingService
Version:
1.0 23 Jan 2001
Author:
Controls Middleware Project

Member Function Documentation

void cern.cmw.mom.pubsub.Subscriber.close (  ) 

Close the publisher singleton instance and dealloacate any resource.

Referenced by cern.laser.source.alarmsysteminterface.impl.ASISubscriberProxy.close().

void cern.cmw.mom.pubsub.Subscriber.setExceptionListener ( ExceptionListener  listener  ) 

Set the listener for exceptions handling

Parameters:
listener The exceptions listener
long cern.cmw.mom.pubsub.Subscriber.subscribe ( String  topic,
SubscriptionListener  listener,
String  selector 
) throws JMSException, NamingException

Subscribe to the given topic.

Parameters:
topic The String representation of the topic
listener An instance of a class implementing the SubscriptionListener interface
selector The String representation of the filter. May be null.
Exceptions:
JMSException if JMS fails to subscribe due to some internal JMS error.
NamingException if there is a violation in the namespace policy.
Returns:
long the unique subscription token.

Referenced by cern.laser.source.alarmsysteminterface.impl.ASISubscriberProxy.subscribe().

void cern.cmw.mom.pubsub.Subscriber.unSubscribe ( long  subscriptionToken  )  throws JMSException

Close the subscription identified by the subscriptionToken.

Parameters:
subscriptionToken The subscription identifier
Exceptions:
JMSException if JMS fails to unsubscribe due to some internal JMS error.

Referenced by cern.laser.source.alarmsysteminterface.impl.ASISubscriberProxy.unsubscribe().

void cern.cmw.mom.pubsub.Subscriber.unSubscribeAll (  )  throws JMSException

Close all the opened subscriptions.

Exceptions:
JMSException if JMS fails to unsubscribe due to some internal JMS error.

The documentation for this interface was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties