Package javax.jms

Examples of javax.jms.TextMessage.clearBody()


        publisher.publish(tm);
        tm = (TextMessage) consumer1.receive(20000000L);
        assertNotNull(tm);
        msgText = tm.getText();
        assertNull(msgText);
        tm.clearBody();
        tm.setText("Now we are not null");
        publisher.publish(tm);
        tm = (TextMessage) consumer1.receive(2000);
        assertNotNull(tm);
        msgText = tm.getText();
View Full Code Here


        try{
            TextMessage textMsg=(TextMessage) msg;
            String payload="REPLY: "+textMsg.getText();
            Destination replyTo;
            replyTo=msg.getJMSReplyTo();
            textMsg.clearBody();
            textMsg.setText(payload);
            requestServerProducer.send(replyTo,textMsg);
        }catch(JMSException e){
            // TODO Auto-generated catch block
            e.printStackTrace();
View Full Code Here

        try{
            TextMessage textMsg=(TextMessage) msg;
            String payload="REPLY: "+textMsg.getText();
            Destination replyTo;
            replyTo=msg.getJMSReplyTo();
            textMsg.clearBody();
            textMsg.setText(payload);
            log.info("Sending response: " + textMsg);
            requestServerProducer.send(replyTo,textMsg);
        }catch(JMSException e){
            // TODO Auto-generated catch block
View Full Code Here

                try{
                    TextMessage textMsg=(TextMessage) msg;
                    String payload="REPLY: "+textMsg.getText();
                    Destination replyTo;
                    replyTo=msg.getJMSReplyTo();
                    textMsg.clearBody();
                    textMsg.setText(payload);
                    remoteProducer.send(replyTo,textMsg);
                }catch(JMSException e){
                    // TODO Auto-generated catch block
                    e.printStackTrace();
View Full Code Here

         fail();
      }
      catch(MessageNotWriteableException e)
      {}

      m2.clearBody();
      assertNull(m2.getText());
      m2.setText("Now it is read-write");


   }
View Full Code Here

         }
        
         msg.clearProperties();
         msg.setIntProperty("iProp", 456);
        
         msg.clearBody();
         msg.setText("other");
        
         session.rollback();
        
         // Check that the original message was not modified
View Full Code Here

        catch (MessageNotWriteableException e)
        {
          // Ignore
        }
       
        msg.clearBody();
       
        msg.setText("foofoo");
        assertEquals("foofoo", msg.getText());
       
        consumer.close();
View Full Code Here

    // Retrieve text portion of message.
    TextMessage msg = (TextMessage)aMessage;
    try {
      // Clear the message body for the reply, so we do not
      // have to do it later.
      msg.clearBody();
    }
    catch (Exception e) {
      String errMsg = "Error clearing the message body.";
      throw new CommandException(errMsg + ". The exception is: " +
          e.getMessage());
View Full Code Here

    // Retrieve text portion of message.
    TextMessage msg = (TextMessage)aMessage;
    try {
      // Clear the message body for the reply, so we do not
      // have to do it later.
      msg.clearBody();
    }
    catch (Exception e) {
      String errMsg = "Error clearing the message body.";
      throw new CommandException(errMsg + ". The exception is: " +
          e.getMessage());
View Full Code Here

                try {
                    TextMessage textMsg = (TextMessage)msg;
                    String payload = "REPLY: " + textMsg.getText();
                    Destination replyTo;
                    replyTo = msg.getJMSReplyTo();
                    textMsg.clearBody();
                    textMsg.setText(payload);
                    remoteProducer.send(replyTo, textMsg);
                } catch (JMSException e) {
                    e.printStackTrace();
                }
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.