1 21 package com.presumo.jms.client; 22 23 import com.presumo.jms.selector.JmsOperand; 24 import com.presumo.jms.selector.Parser; 25 26 import javax.jms.TopicSubscriber ; 27 import javax.jms.JMSException ; 28 import javax.jms.Topic ; 29 30 31 38 public final class JmsTopicSubscriber extends JmsMessageConsumer 39 implements TopicSubscriber 40 { 41 42 43 private final JmsTopic topic; 47 private final boolean noLocal; 48 private final JmsOperand filter; 49 50 51 JmsTopicSubscriber(JmsTopicSession session, 55 String selector, 56 JmsTopic topic, 57 boolean nolocal, 58 String durableID) 59 throws JMSException 60 { 61 super(session, selector); 62 this.topic = topic; 63 this.noLocal = nolocal; 64 65 this.selector = topic.prepareContentFilter(selector); 70 71 if (durableID == null || durableID.length() == 0) { 72 74 filter = Parser.getInstance().parseFilter(this.selector); 76 77 mySession.addConsumer(this); 78 } 79 else { 80 83 String uniqueID = createUniqueID(); 85 86 String userSelector = this.selector; 88 this.selector = generateSystemFilter(durableID, uniqueID); 89 90 this.filter = Parser.getInstance().parseFilter(this.selector); 91 mySession.addConsumer(this); 92 93 session.sendQueueRequest(durableID, uniqueID, userSelector, JmsSession.DURABLE_SUBSCRIBER_CRT); } 98 } 99 100 104 public Topic getTopic() throws JMSException 105 { 106 return topic; 107 } 108 109 public boolean getNoLocal() throws JMSException 110 { 111 return noLocal; 112 } 113 114 115 119 125 final JmsOperand getFilter() 126 { 127 return this.filter; 128 } 129 130 } 131 | Popular Tags |