Package javax.jms

Examples of javax.jms.TopicSession.createDurableSubscriber()


                    // durable subscriber otherwise transient
                    TopicSubscriber subscriber = null;
                    String name = cmdline.value("name");
                    if (name != null) {

                        subscriber = session.createDurableSubscriber
                            (topic, name, selector, false);
                    } else {
                        subscriber = session.createSubscriber(topic, selector, false);
                    }
View Full Code Here


             connection.start();
       Topic topic = session.createTopic("OpenJMSDemo-deals");
       // if the 'name' option has been specified then assume a
       // durable subscriber otherwise transient
       TopicSubscriber subscriber = null;
       subscriber = session.createDurableSubscriber(topic, "DealMgr");
       subscriber.setMessageListener(new DealManager());
       System.err.println("Message listener has been set");
    }
    catch (Exception exception)
        {
View Full Code Here

      getLog().debug("Draining Durable Topic");
      topicDurableConnection.start();

      final TopicSession session = topicDurableConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
      Topic topic = (Topic)context.lookup(TEST_DURABLE_TOPIC);
      TopicSubscriber subscriber = session.createDurableSubscriber(topic, "test");

      Message message = subscriber.receive(1000);
      int c = 0;
      while (message != null)
      {
View Full Code Here

         getLog().debug("Closing the subscriber without acknowledgement");
         subSession.close();

         getLog().debug("Subscribing to topic, looking for Value = 'B'");
         subSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
         subscriber = subSession.createDurableSubscriber(topic, "test", "Value = 'B'", false);

         getLog().debug("Retrieving the non-existent B messages");
         assertTrue("B should not be there", subscriber.receive(2000) == null);

         getLog().debug("Closing the subscriber.");
View Full Code Here

         getLog().debug("Closing the subscriber.");
         subSession.close();

         getLog().debug("Subscribing to topic, looking for those Value = 'A'");
         subSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
         subscriber = subSession.createDurableSubscriber(topic, "test", "Value = 'A'", false);
         assertTrue("Should not be any A the subscription was changed", subscriber.receive(2000) == null);
         subSession.close();

         getLog().debug("Subscribing to topic, looking for everything");
         subSession = topicConnection.createTopicSession(false, Session.CLIENT_ACKNOWLEDGE);
View Full Code Here

         assertTrue("Should not be any A the subscription was changed", subscriber.receive(2000) == null);
         subSession.close();

         getLog().debug("Subscribing to topic, looking for everything");
         subSession = topicConnection.createTopicSession(false, Session.CLIENT_ACKNOWLEDGE);
         subscriber = subSession.createDurableSubscriber(topic, "test", null, false);

         message = sendSession.createTextMessage("Message4");
         message.setStringProperty("Value", "A");
         sender.publish(message);
View Full Code Here

         assertTrue("Should be an A which we don't acknowledge", message.getStringProperty("Value").equals("A"));
         subSession.close();

         getLog().debug("Subscribing to topic, looking for the Value = 'A'");
         subSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
         subscriber = subSession.createDurableSubscriber(topic, "test", "Value = 'A'", false);
         assertTrue(
            "Should not be any A, the subscription was changed. Even though the old and new selectors match the message",
            subscriber.receive(2000) == null);
         subSession.close();
View Full Code Here

         TopicSession sendSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
         TopicPublisher sender = sendSession.createPublisher(topic);

         getLog().debug("Clearing the topic");
         TopicSession subSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
         TopicSubscriber subscriber = subSession.createDurableSubscriber(topic, "test");
         TextMessage message = (TextMessage) subscriber.receive(50);
         while (message != null)
            message = (TextMessage) subscriber.receive(50);
         subSession.close();
View Full Code Here

            message = (TextMessage) subscriber.receive(50);
         subSession.close();

         getLog().debug("Subscribing to topic, with null selector");
         subSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
         subscriber = subSession.createDurableSubscriber(topic, "test", null, false);

         getLog().debug("Send a message");
         message = sendSession.createTextMessage("Message1");
         sender.publish(message);
View Full Code Here

         getLog().debug("Closing the subscriber");
         subSession.close();

         getLog().debug("Subscribing to topic, with an empty selector");
         subSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
         subscriber = subSession.createDurableSubscriber(topic, "test", "   ", false);

         getLog().debug("Send a message");
         message = sendSession.createTextMessage("Message2");
         sender.publish(message);
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.