Examples of receiveNoWait()


Examples of javax.jms.MessageConsumer.receiveNoWait()

            assertNull(sessionRunnable.error);

            // Drain the queue
            QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
            MessageConsumer consumer = session.createConsumer(queue);
            while (consumer.receiveNoWait() != null);
            session.close();
         }
      }
      finally
      {
View Full Code Here

Examples of javax.jms.MessageConsumer.receiveNoWait()

            assertNull(sessionRunnable.error);

            // Drain the queue
            QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
            MessageConsumer consumer = session.createConsumer(queue);
            while (consumer.receiveNoWait() != null);
            session.close();
         }
      }
      finally
      {
View Full Code Here

Examples of javax.jms.MessageConsumer.receiveNoWait()

         MessageConsumer consumer = sessionRunnable.getConsumer();
         try
         {
            while (true)
            {
               if (consumer.receiveNoWait() != null)
                  sessionRunnable.incReceived();
            }
         }
         catch (JMSException expected)
         {
View Full Code Here

Examples of javax.jms.MessageConsumer.receiveNoWait()

         conn = cf.createConnection();
         Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
         conn.start();
         MessageConsumer cons = sess.createConsumer(queue);
        
         while (cons.receiveNoWait() != null);
        
        
      }
      finally
      {
View Full Code Here

Examples of javax.jms.MessageConsumer.receiveNoWait()

      //send it back
      sender2.send(msg);

      msg = (TextMessage) subscriber1.receive(2000);
      assertTrue("Subscriber1 should get a message, got " + msg, msg != null && msg.getText().equals("Message"));
      assertTrue("Subscriber2 should not get a message", subscriber2.receiveNoWait() == null);

      topicConnection1.stop();
      topicConnection1.close();
      topicConnection2.stop();
      topicConnection2.close();
View Full Code Here

Examples of javax.jms.MessageConsumer.receiveNoWait()

         queueConnection.start();
         message = (TextMessage) receiver.receive(5000);
         assertEquals("OK", message.getText());

         // Should be no more
         assertTrue("Didn't expect anymore messages", receiver.receiveNoWait() == null);
      }
      finally
      {
         disconnect();
      }
View Full Code Here

Examples of javax.jms.MessageConsumer.receiveNoWait()

         // Try to receive the OK message
         message = (TextMessage) receiver.receive(5000);
         assertEquals("OK", message.getText());

         // Should be no more
         assertTrue("Didn't expect anymore messages", receiver.receiveNoWait() == null);

         // Send a message that expires in 10 seconds
         message = session.createTextMessage("10 Second Expiration");
         sender.send(message, DeliveryMode.PERSISTENT, 4, 10*1000);
         // Send a message that has not expired
View Full Code Here

Examples of javax.jms.MessageConsumer.receiveNoWait()

         assertEquals("10 Second Expiration", message.getText());
         message = (TextMessage) receiver.receive(5000);
         assertEquals("OK", message.getText());

         // Should be no more
         assertTrue("Didn't expect anymore messages", receiver.receiveNoWait() == null);
        
         // Test that JMSExpiration has no affect
         message = session.createTextMessage("5 Second Expiration");
         message.setJMSExpiration(System.currentTimeMillis() + 5*1000);
         sender.send(message, DeliveryMode.PERSISTENT, 4, 0);
View Full Code Here

Examples of javax.jms.MessageConsumer.receiveNoWait()

         // Try to receive the OK message
         message = (TextMessage) receiver.receive(5000);
         assertEquals("5 Second Expiration", message.getText());
         message = (TextMessage) receiver.receive(5000);
         assertEquals("OK", message.getText());
         assertTrue("Didn't expect anymore messages", receiver.receiveNoWait() == null);
      }
      finally
      {
         disconnect();
      }
View Full Code Here

Examples of javax.jms.MessageConsumer.receiveNoWait()

            try
            {
               c.start();
               Session s = c.createSession(true, Session.SESSION_TRANSACTED);
               MessageConsumer mc = s.createConsumer(queue);
               while (mc.receiveNoWait() != null);
               mc.close();
              
               MessageProducer p = s.createProducer(queue);
               Message m = s.createTextMessage("101");
               p.send(m);
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.