Package javax.jms

Examples of javax.jms.QueueSender.send()


         // 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
         message = session.createTextMessage("OK");
         sender.send(message);
         // Sleep 1 seconds
         Thread.sleep(1*1000);
 
View Full Code Here


         // 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
         message = session.createTextMessage("OK");
         sender.send(message);
         // Sleep 1 seconds
         Thread.sleep(1*1000);
         // Try to receive the messages
         message = (TextMessage) receiver.receiveNoWait();
         assertEquals("10 Second Expiration", message.getText());
View Full Code Here

         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);
         // Send a message that has not expired
         message = session.createTextMessage("OK");
         sender.send(message);
         // Sleep 6 seconds
         Thread.sleep(6*1000);
 
View Full Code Here

         message = session.createTextMessage("5 Second Expiration");
         message.setJMSExpiration(System.currentTimeMillis() + 5*1000);
         sender.send(message, DeliveryMode.PERSISTENT, 4, 0);
         // Send a message that has not expired
         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());
View Full Code Here

         QueueSender sender = session.createSender(queue);
         QueueReceiver receiver = session.createReceiver(queue);

         // Send a message that has expired
         TextMessage message = session.createTextMessage("Outdated");
         sender.send(message, DeliveryMode.PERSISTENT, 4, 1);
         Thread.sleep(100);

         // Send a message that has not expired
         message = session.createTextMessage("OK");
         sender.send(message);
View Full Code Here

         sender.send(message, DeliveryMode.PERSISTENT, 4, 1);
         Thread.sleep(100);

         // Send a message that has not expired
         message = session.createTextMessage("OK");
         sender.send(message);

         // Try to receive the message the not expired message
         final Synch synch = new Synch();
         MessageListener messagelistener = new MessageListener()
         {
View Full Code Here

      QueueSender sender = session.createSender(queue);

      // send 20 messages to the queue
      for ( int i=0; i<20; i++ )
      {
         sender.send(session.createObjectMessage(new Integer(i)));
      }

      //close the session, so we can start one with CLIENT_ACKNOWLEDGE
      session.close();
      queueConnection.stop();
View Full Code Here

      QueueSender sender = session.createSender(queue);

      // send 4 messages to the queue
      for (int i=0; i<4; ++i)
      {
         sender.send(session.createObjectMessage(new Integer(i)));
      }

      //create our receiver
      QueueReceiver receiver = session.createReceiver( queue );
      final Synch synch = new Synch();
View Full Code Here

      QueueSender sender = session.createSender(queue);

      // send 20 messages to the queue
      for ( int i=0; i<20; i++ )
      {
         sender.send(session.createObjectMessage(new Integer(i)));
      }

      //close the session, so we can start one with CLIENT_ACKNOWLEDGE
      session.close();
      queueConnection.stop();
View Full Code Here

      QueueSender sender = session.createSender(queue);

      // send 20 messages to the queue
      for ( int i=0; i<20; i++ )
      {
         sender.send(session.createObjectMessage(new Integer(i)));
      }

      //close the session, so we can start one with CLIENT_ACKNOWLEDGE
      session.close();
      queueConnection.stop();
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.