1 package net.walend.somnifugi; 2 3 import javax.jms.TopicSubscriber ; 4 import javax.jms.Topic ; 5 import javax.jms.JMSException ; 6 import javax.jms.Message ; 7 8 import net.walend.somnifugi.channel.Takable; 9 10 16 17 public class SomniTopicSubscriber 18 extends SomniMessageConsumer 19 implements TopicSubscriber 20 { 21 private SomniTopic topic; 22 private String name; 23 24 protected SomniTopicSubscriber(SomniTopic topic,Takable<Message > feed,String name,SomniExceptionListener exceptionListener,SomniSession session) 25 { 26 super(feed,exceptionListener,session); 27 this.name = name; 28 this.topic = topic; 29 } 30 31 protected SomniTopicSubscriber(SomniTopic topic,Takable<Message > feed,String name,SomniExceptionListener exceptionListener,SomniMessageSelector messageSelector,SomniSession session) 32 { 33 super(feed,exceptionListener,messageSelector,session); 34 this.name = name; 35 this.topic = topic; 36 } 37 38 46 public Topic getTopic() 47 throws JMSException 48 { 49 return topic; 50 } 51 52 64 public boolean getNoLocal() 65 throws JMSException 66 { 67 return false; 68 } 69 70 public void close() 71 throws JMSException 72 { 73 super.close(); 74 topic.removeSubscriber(name); 76 } 77 78 protected SomniDestination getDestination() 79 { 80 return topic; 81 } 82 83 public String getName() 84 { 85 return name; 86 } 87 } 88 89 109 | Popular Tags |