Examples of createTopicSession()


Examples of javax.jms.TopicConnection.createTopicSession()

        durSub1.close();

        // Create a publisher and send a persistent message which matches the selector
        // followed by one that does not match, and another which matches but is not
        // committed and so should be 'lost'
        TopicSession pubSession = connection.createTopicSession(true, Session.SESSION_TRANSACTED);
        TopicPublisher publisher = pubSession.createPublisher(topic);

        publishMessages(pubSession, publisher, topic, DeliveryMode.PERSISTENT, 1*1024, 1, "true");
        publishMessages(pubSession, publisher, topic, DeliveryMode.PERSISTENT, 1*1024, 1, "false");
        pubSession.commit();
View Full Code Here

Examples of javax.jms.TopicConnection.createTopicSession()

        // Create and register a durable subscriber without selector and then close it
        TopicSubscriber durSub1 = session.createDurableSubscriber(topic, SUB_NAME);
        durSub1.close();

        // Create a publisher and send a persistent message which matches the subscription
        TopicSession pubSession = connection.createTopicSession(true, Session.SESSION_TRANSACTED);
        TopicPublisher publisher = pubSession.createPublisher(topic);

        publishMessages(pubSession, publisher, topic, DeliveryMode.PERSISTENT, 1*1024, 1, "indifferent");
        pubSession.commit();

View Full Code Here

Examples of javax.jms.TopicConnection.createTopicSession()

      TopicConnection conn = null;
     
      try
      {
         conn = cf.createTopicConnection();
         TopicSession sess = conn.createTopicSession(true, 0);
         TopicPublisher pub = sess.createPublisher(topic1);
         pub.setDeliveryMode(DeliveryMode.PERSISTENT);
        
         Message m = sess.createTextMessage("testing123");
         pub.publish(m);
View Full Code Here

Examples of javax.jms.TopicConnection.createTopicSession()

     
      try
      {
         conn = cf.createTopicConnection();
         conn.start();
         TopicSession sess = conn.createTopicSession(true, 0);
         TopicPublisher pub = sess.createPublisher(topic1);
         TopicSubscriber sub = sess.createSubscriber(topic1);
         pub.setDeliveryMode(DeliveryMode.PERSISTENT);
        
         Message m = sess.createTextMessage("testing123");
View Full Code Here

Examples of javax.jms.TopicConnection.createTopicSession()

      TopicConnection conn = null;
     
      try
      {
         conn = cf.createTopicConnection();
         TopicSession sess = conn.createTopicSession(true, 0);
         TopicPublisher pub = sess.createPublisher(topic1);
         TopicSubscriber cons = sess.createSubscriber(topic1);
         conn.start();
        
         Message m = sess.createTextMessage("testing123");
View Full Code Here

Examples of javax.jms.TopicConnection.createTopicSession()

         conn = cf.createTopicConnection();
         conn.start();
        
         //test 2
        
         TopicSession newsess = conn.createTopicSession(true, 0);
         TopicPublisher newpub = newsess.createPublisher(topic1);
         TopicSubscriber newcons = newsess.createSubscriber(topic1);
        
         Message m3 = newsess.createTextMessage("testing456");
         newpub.publish(m3);
View Full Code Here

Examples of javax.jms.TopicConnection.createTopicSession()

            if (userName != null) {
                conn = factory.createTopicConnection(userName, password);
            } else {
                conn = factory.createTopicConnection();
            }
            final TopicSession sess = conn.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
            final Topic topic = (Topic) lookup(context, queueBindingName);
            final TopicPublisher publisher = sess.createPublisher(topic);
            conn.start();
            return new TopicInfo(conn, sess, publisher);
        } catch (final NamingException ex) {
View Full Code Here

Examples of javax.jms.TopicConnection.createTopicSession()

            final Context ctx = new InitialContext();
            TopicConnectionFactory topicConnectionFactory;
            topicConnectionFactory = (TopicConnectionFactory) lookup(ctx, tcfBindingName);
            final TopicConnection topicConnection = topicConnectionFactory.createTopicConnection(username, password);
            topicConnection.start();
            final TopicSession topicSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
            final Topic topic = (Topic) ctx.lookup(topicBindingName);
            final TopicSubscriber topicSubscriber = topicSession.createSubscriber(topic);
            topicSubscriber.setMessageListener(this);
        } catch (final JMSException e) {
            logger.error("Could not read JMS message.", e);
View Full Code Here

Examples of javax.jms.TopicConnection.createTopicSession()

   }

   public void testCreateQueueOnATopicSession() throws Exception
   {
      TopicConnection c = (TopicConnection)getConnectionFactory().createConnection();
      TopicSession s = c.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);

      try
      {
         s.createQueue("TestQueue");
         ProxyAssertSupport.fail("should throw IllegalStateException");
View Full Code Here

Examples of javax.jms.TopicConnection.createTopicSession()

   {
      TopicConnection conn1 = ((TopicConnectionFactory)JMSTestCase.topicCf).createTopicConnection();
      TopicConnection conn2 = ((TopicConnectionFactory)JMSTestCase.topicCf).createTopicConnection();

      TopicSession sess1 = conn1.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
      TopicSession sess2 = conn2.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);

      TopicSubscriber sub1 = sess1.createSubscriber(HornetQServerTestCase.topic1);
      TopicSubscriber sub2 = sess2.createSubscriber(HornetQServerTestCase.topic1);

      conn1.start();
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.