Examples of receiveNoWait()


Examples of javax.jms.QueueReceiver.receiveNoWait()

         message = session.createTextMessage("OK");
         sender.send(message);
         // Sleep 6 seconds
         Thread.sleep(6*1000);
         // Try to receive the OK message
         message = (TextMessage) receiver.receiveNoWait();
         assertEquals("5 Second Expiration", message.getText());
         message = (TextMessage) receiver.receiveNoWait();
         assertEquals("OK", message.getText());
         assertTrue("Didn't expect anymore messages", receiver.receiveNoWait() == null);
      }
View Full Code Here

Examples of javax.jms.QueueReceiver.receiveNoWait()

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

Examples of javax.jms.QueueReceiver.receiveNoWait()

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

Examples of javax.jms.QueueReceiver.receiveNoWait()

      //To implement receiveNoWait otherwise would be very costly
      //Also other messaging systems e.g. Sun implement it this way

      Thread.sleep(1000);

      Message message = receiver.receiveNoWait();
      int messagecounter=0;

      while( message != null )
      {
         message = receiver.receiveNoWait();
View Full Code Here

Examples of javax.jms.QueueReceiver.receiveNoWait()

      Message message = receiver.receiveNoWait();
      int messagecounter=0;

      while( message != null )
      {
         message = receiver.receiveNoWait();
         messagecounter++;
      }

      if ( messagecounter != 20 )
      {
View Full Code Here

Examples of javax.jms.QueueReceiver.receiveNoWait()

      session.recover();

      // See previous note on sleep
      Thread.sleep(1000);

      message = receiver.receiveNoWait();
      messagecounter=0;

      while( message != null )
      {
         if ( !message.getJMSRedelivered() )
View Full Code Here

Examples of javax.jms.QueueReceiver.receiveNoWait()

            throw new Exception ( "Message was not marked as redelivered! messagecounter=" + messagecounter );
         }

         message.acknowledge();
         messagecounter++;
         message = receiver.receiveNoWait();
      }

      if ( messagecounter != 20 )
      {
         throw new Exception ( "Not all unacknowledged messages were redelivered! messagecounter=" + messagecounter );
View Full Code Here

Examples of javax.jms.QueueReceiver.receiveNoWait()

      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
      Queue queue = (Queue)context.lookup(TEST_QUEUE);

      QueueReceiver receiver = session.createReceiver(queue);
      queueConnection.start();
      Message message = receiver.receiveNoWait();
      int c = 0;
      while (message != null)
      {
         message = receiver.receiveNoWait();
         c++;
View Full Code Here

Examples of javax.jms.QueueReceiver.receiveNoWait()

      queueConnection.start();
      Message message = receiver.receiveNoWait();
      int c = 0;
      while (message != null)
      {
         message = receiver.receiveNoWait();
         c++;
      }

      if (c != 0)
         getLog().debug("  Drained " + c + " messages from the queue");
View Full Code Here

Examples of javax.jms.QueueReceiver.receiveNoWait()

            PrintWriter out = arg1.getWriter();
            QueueConnection connection = qcf.createQueueConnection();
            connection.start();
            QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
            QueueReceiver queueReceiver = session.createReceiver(queue);
            Message msg = queueReceiver.receiveNoWait();

            if ( msg instanceof TextMessage ) {
                TextMessage txtMsg = (TextMessage)msg;
                System.out.println("Message : "+txtMsg.getText());
                out.println("<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>");
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.