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 |
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.
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
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.
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. |
JMSException | if JMS fails to subscribe due to some internal JMS error. | |
NamingException | if there is a violation in the namespace policy. |
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.
subscriptionToken | The subscription identifier |
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.
JMSException | if JMS fails to unsubscribe due to some internal JMS error. |