Package javax.jms

Examples of javax.jms.Session.createTextMessage()


         }
        
         // test receive(long)
         msgIn = new TextMessage[nmax];
         for (int i=0; i < nmax; i++) {
            msgIn[i] = publisherSession.createTextMessage();
            msgIn[i].setText("msg " + i);
            publisher.send(this.topic, msgIn[i]);
         }
         for (int i=0; i < nmax; i++) {
            msg2 = consumer.receive(200L);
View Full Code Here


         }

         // test receive()
         msgIn = new TextMessage[nmax];
         for (int i=0; i < nmax; i++) {
            msgIn[i] = publisherSession.createTextMessage();
            msgIn[i].setText("msg " + i);
            publisher.send(this.topic, msgIn[i]);
         }
         for (int i=0; i < nmax; i++) {
            msg2 = consumer.receive();
View Full Code Here

        // clear old messages
        while (receiver.receive(1) != null) {
            ;
        }

        requestor.oneWay(null, session.createTextMessage("bonson"), 1);
        Thread.sleep(50);
        assertNull(receiver.receive(1));

        requestor.oneWay(null, session.createTextMessage("bonson2"), -1);
        TextMessage message = (TextMessage) receiver.receive(1000);
View Full Code Here

        requestor.oneWay(null, session.createTextMessage("bonson"), 1);
        Thread.sleep(50);
        assertNull(receiver.receive(1));

        requestor.oneWay(null, session.createTextMessage("bonson2"), -1);
        TextMessage message = (TextMessage) receiver.receive(1000);
        assertNotNull(message);
        assertEquals("bonson2", message.getText());
    }
View Full Code Here

        // clear old messages
        while (receiver.receive(1) != null) {
            ;
        }

        requestor.oneWay(null, session.createTextMessage("bonson"), 1);
        Thread.sleep(50);
        assertNull(receiver.receive(1));

        requestor.oneWay(null, session.createTextMessage("bonson2"), -1);
        TextMessage message = (TextMessage) receiver.receive(1000);
View Full Code Here

        requestor.oneWay(null, session.createTextMessage("bonson"), 1);
        Thread.sleep(50);
        assertNull(receiver.receive(1));

        requestor.oneWay(null, session.createTextMessage("bonson2"), -1);
        TextMessage message = (TextMessage) receiver.receive(1000);
        assertNotNull(message);
        assertEquals("bonson2", message.getText());
    }
}
View Full Code Here

      int messageCount = 20;

      for(int i = 0; i < messageCount; i++)
      {
         Message m = session.createTextMessage("krakatau" + i);
         prod.send(m);
      }

      conn.close();
View Full Code Here

     
      MessageConsumer cons = sess.createConsumer(dest);
     
      conn.start();
     
      TextMessage tm = sess.createTextMessage("ref test");
     
      prod.send(tm);
     
      tm = (TextMessage)cons.receive(1000);
     
View Full Code Here

               Session sess = conn.createSession(true, Session.SESSION_TRANSACTED);
               MessageProducer producer = sess.createProducer((Destination)queue);

               for (int j = 0; j < 20; j++)
               {
                  producer.send(sess.createTextMessage("Message " + i + ", " + j));

                  if (j % 2 == 0)
                  {
                     log.debug("commit");
                     messagesProduced += (messageCount - lastMessage);
View Full Code Here

      MessageProducer prod = sess.createProducer(queue);
      prod.setDeliveryMode(DeliveryMode.PERSISTENT);
     
      for (int i = 0; i < 10; i++)
      {
         TextMessage tm = sess.createTextMessage("message" + i);
         prod.send(tm);
      }
     
      conn.close();
     
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.