Oracle GlassFish Message Queue 4.4.2 Developer's Guide for Java Clients

Composing Text Messages

You create a text message with the session method createTextMessage. You can either initialize the message body directly at creation time

TextMessage  outMsg = mySession.createTextMessage("Hello, World!");

or simply create an empty message and then use its setText method (see Table 2–9 ) to set its content:

TextMessage  outMsg = mySession.createTextMessage();
outMsg.setText("Hello, World!");
Table 2–9 Text Message Composition Method




Set content string