Package javax.jms

Examples of javax.jms.TopicSession.createSubscriber()


      try
      {
         TopicSession session = getTopicSession();
         if (trace)
            log.trace("createSubscriber " + session + " topic=" + topic);
         TopicSubscriber result = session.createSubscriber(topic);
         result = new JmsTopicSubscriber(result, this);
         if (trace)
            log.trace("createdSubscriber " + session + " JmsTopicSubscriber=" + result);
         addConsumer(result);
         return result;
View Full Code Here


      try
      {
         TopicSession session = getTopicSession();
         if (trace)
            log.trace("createSubscriber " + session + " topic=" + topic + " selector=" + messageSelector + " noLocal=" + noLocal);
         TopicSubscriber result = session.createSubscriber(topic, messageSelector, noLocal);
         result = new JmsTopicSubscriber(result, this);
         if (trace)
            log.trace("createdSubscriber " + session + " JmsTopicSubscriber=" + result);
         addConsumer(result);
         return result;
View Full Code Here

         TemporaryTopic temp = session.createTemporaryTopic();

         boolean caught = false;
         try
         {
            session.createSubscriber(null);
         }
         catch (InvalidDestinationException expected)
         {
            caught = true;
         }
View Full Code Here

         assertTrue("Expected an InvalidDestinationException for a null topic", caught);

         caught = false;
         try
         {
            session.createSubscriber(null, null, true);
         }
         catch (InvalidDestinationException expected)
         {
            caught = true;
         }
View Full Code Here

      //set up some subscribers to the topic
      TopicSession session = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
      Topic topic = (Topic) context.lookup(TEST_TOPIC);

      TopicSubscriber sub1 = session.createDurableSubscriber(topic, "sub1");
      TopicSubscriber sub2 = session.createSubscriber(topic);
      TopicSubscriber sub3 = session.createSubscriber(topic);

      //Now a sender
      TopicPublisher sender = session.createPublisher(topic);
View Full Code Here

      TopicSession session = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
      Topic topic = (Topic) context.lookup(TEST_TOPIC);

      TopicSubscriber sub1 = session.createDurableSubscriber(topic, "sub1");
      TopicSubscriber sub2 = session.createSubscriber(topic);
      TopicSubscriber sub3 = session.createSubscriber(topic);

      //Now a sender
      TopicPublisher sender = session.createPublisher(topic);

      //send some messages
View Full Code Here

      drainMessagesForTopic(sub3);

      //open subscribers again.
      sub1 = session.createDurableSubscriber(topic, "sub1");
      sub2 = session.createSubscriber(topic);

      //Send a final message
      sender.publish(session.createTextMessage("Final message"));
      sender.close();
View Full Code Here

      topicConnection2.start();

      // We don't want local messages on this topic.
      TopicSession session1 = topicConnection1.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
      Topic topic = (Topic) context.lookup(TEST_TOPIC);
      TopicSubscriber subscriber1 = session1.createSubscriber(topic, null, true);
      TopicPublisher sender1 = session1.createPublisher(topic);

      //Now a sender
      TopicSession session2 = topicConnection2.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
      TopicPublisher sender2 = session2.createPublisher(topic);
View Full Code Here

      topicConnection2.start();

      // Session 1
      TopicSession session1 = topicConnection1.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
      Topic topic = (Topic) context.lookup(TEST_TOPIC);
      TopicSubscriber subscriber1 = session1.createSubscriber(topic, null, true);
      TopicPublisher sender1 = session1.createPublisher(topic);

      // Session 2
      TopicSession session2 = topicConnection2.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
      TopicSubscriber subscriber2 = session2.createSubscriber(topic, null, true);
View Full Code Here

      TopicSubscriber subscriber1 = session1.createSubscriber(topic, null, true);
      TopicPublisher sender1 = session1.createPublisher(topic);

      // Session 2
      TopicSession session2 = topicConnection2.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
      TopicSubscriber subscriber2 = session2.createSubscriber(topic, null, true);
      TopicPublisher sender2 = session2.createPublisher(topic);

      drainMessagesForTopic(subscriber1);
      drainMessagesForTopic(subscriber2);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.