1 45 package org.exolab.jms.client; 46 47 import javax.jms.JMSException ; 48 import javax.jms.Queue ; 49 import javax.jms.QueueBrowser ; 50 import javax.jms.TemporaryQueue ; 51 import javax.jms.Topic ; 52 import javax.jms.TopicPublisher ; 53 import javax.jms.TopicSession ; 54 import javax.jms.TopicSubscriber ; 55 56 57 64 class JmsTopicSession 65 extends JmsSession 66 implements TopicSession { 67 68 81 public JmsTopicSession(JmsTopicConnection connection, boolean transacted, 82 int ackMode) throws JMSException { 83 super(connection, transacted, ackMode); 84 } 85 86 93 public TopicSubscriber createSubscriber(Topic topic) throws JMSException { 94 return createSubscriber(topic, null, false); 95 } 96 97 108 public synchronized TopicSubscriber createSubscriber(Topic topic, 109 String selector, 110 boolean noLocal) 111 throws JMSException { 112 long consumerId = allocateConsumer(topic, selector, noLocal); 113 JmsTopicSubscriber subscriber = new JmsTopicSubscriber(this, 114 consumerId, 115 topic, selector, 116 noLocal); 117 addConsumer(subscriber); 118 return subscriber; 119 } 120 121 129 public synchronized TopicPublisher createPublisher(Topic topic) 130 throws JMSException { 131 132 ensureOpen(); 133 134 if (topic != null && ((JmsTopic) topic).isWildCard()) { 135 throw new JMSException ( 136 "Cannot create a publisher using a wildcard topic"); 137 } 138 139 JmsTopicPublisher publisher = 140 new JmsTopicPublisher(this, (JmsTopic) topic); 141 addProducer(publisher); 142 143 return publisher; 144 } 145 146 152 public QueueBrowser createBrowser(Queue queue, String messageSelector) 153 throws JMSException { 154 throw new IllegalStateException ("Invalid operation for TopicSession"); 155 } 156 157 163 public TemporaryQueue createTemporaryQueue() throws JMSException { 164 throw new IllegalStateException ("Invalid operation for TopicSession"); 165 } 166 167 173 public Queue createQueue(String queueName) throws JMSException { 174 throw new IllegalStateException ("Invalid operation for TopicSession"); 175 } 176 177 } 178 179 | Popular Tags |