Package javax.jms

Examples of javax.jms.TopicConnection.start()


            TopicConnection connection = tcf.createTopicConnection();
            TopicSession session = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
            TopicSubscriber topicSubscriber = session.createSubscriber(topic);
            TestListener test = new TestListener();
            topicSubscriber.setMessageListener(test);
            connection.start();
            TopicPublisher topicPublisher = session.createPublisher(topic);
            TextMessage tmsg = session.createTextMessage("JMS - Test Topic Message");
            topicPublisher.publish(tmsg);
            if ( msg != null ) {
                out.println("<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>");
View Full Code Here


            assertEquals("DurableSubscription backing queue should have 1 message on it initially",
                          new Integer(1), dursubQueue.getMessageCount());

            // Create a connection and start it
            TopicConnection connection = (TopicConnection) getConnection();
            connection.start();

            // Send messages which don't match and do match the selector, checking message count
            TopicSession pubSession = connection.createTopicSession(true, Session.SESSION_TRANSACTED);
            Topic topic = pubSession.createTopic(SELECTOR_TOPIC_NAME);
            TopicPublisher publisher = pubSession.createPublisher(topic);
View Full Code Here

            assertEquals("DurableSubscription backing queue should have 1 message on it initially",
                          new Integer(1), dursubQueue.getMessageCount());

            // Create a connection and start it
            TopicConnection connection = (TopicConnection) getConnection();
            connection.start();

            // Send new message matching the topic, checking message count
            TopicSession session = connection.createTopicSession(true, Session.SESSION_TRANSACTED);
            Topic topic = session.createTopic(TOPIC_NAME);
            TopicPublisher publisher = session.createPublisher(topic);
View Full Code Here

     */
    public void testBindingAndMessageDurabability() throws Exception
    {
        // Create a connection and start it
        TopicConnection connection = (TopicConnection) getConnection();
        connection.start();

        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        Queue queue = session.createQueue(QUEUE_NAME);
        MessageProducer messageProducer = session.createProducer(queue);

View Full Code Here

        // Restart the broker
        restartBroker();

        // Drain the queue of all messages
        connection = (TopicConnection) getConnection();
        connection.start();
        consumeQueueMessages(connection, true);
    }

    /**
     * Test that all of the committed persistent messages previously sent to
View Full Code Here

    private void prepareDurableSubscriptionWithSelector() throws Exception
    {

        // Create a connection
        TopicConnection connection = _connFac.createTopicConnection();
        connection.start();
        connection.setExceptionListener(new ExceptionListener()
        {
            public void onException(JMSException e)
            {
                e.printStackTrace();
View Full Code Here

     */
    private void prepareDurableSubscriptionWithoutSelector() throws Exception
    {
        // Create a connection
        TopicConnection connection = _connFac.createTopicConnection();
        connection.start();
        connection.setExceptionListener(new ExceptionListener()
        {
            public void onException(JMSException e)
            {
                e.printStackTrace();
View Full Code Here

      TopicConnection conn = null;
     
      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);
        
View Full Code Here

      {
         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");
         pub.publish(m);
         sess.commit();
        
View Full Code Here

         assertEquals("testing123", m2.getText());
        
         conn.close();
        
         conn = cf.createTopicConnection();
         conn.start();
        
         //test 2
        
         TopicSession newsess = conn.createTopicSession(true, 0);
         TopicPublisher newpub = newsess.createPublisher(topic1);
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.