Public Member Functions | |
Client () | |
void | start () |
void | onMessage (javax.jms.Message message) |
void | onException (MOMException e) |
Static Public Member Functions | |
void | main (String[] args) |
Private Attributes | |
Subscriber | s = null |
long | subscriptionToken = 0 |
Static Private Attributes | |
final String | TOPIC = "CMW.ALARM_SYSTEM.ALARM_CATEGORY_TREE.CERN.INSTANT" |
<blockquote>
try { s = PubSubFactory.subscriber(); } catch (MOMException me) { System.out.println("MOMException raised while instantiating a Subscriber"); me.printStackTrace(); }
</blockquote>
And this shows how to implement the onMessage() method for a SubscriptionListener:
<blockquote>
public void onMessage(javax.jms.Message message) { // Subscriber implementation of the listener try { javax.jms.TextMessage msg = (javax.jms.TextMessage)message; System.out.println("Got message : " + msg.getText()); if (msg.getText().equals("bye")) { System.out.println("Time to close!"); s.unSubscribe(subscriptionToken); s.close(); } } catch(javax.jms.JMSException je) { System.out.println("JMSException raised while processing message: "+message); je.printStackTrace(); } }
</blockquote>
|
Constructor Client |
|
Method main
|
|
Method onException
Implements cern::cmw::mom::pubsub::ExceptionListener.
|
|
Method onMessage
|
|
Method start |
|
|
|
|
|
|