Compiling the MessageBrowser Client
Compiling the MessageBrowser Client
if ( !msgs.hasMoreElements() ) {
System.out.println(
"No messages in queue");
} else {
while (msgs.hasMoreElements()) {
Message tempMsg = (Message)msgs.nextElement();
System.out.println(
"Message: " + tempMsg);
}
}
6. Closes the connection, which automatically closes the session and QueueBrowser.
The format in which the message contents appear is implementation-specific. In the
Application Server, the message format looks like this:
Message contents:
Text:
This is message 3
Class:
com.sun.messaging.jmq.jmsclient.TextMessageImpl
getJMSMessageID():
ID:14-129.148.71.199(f9:86:a2:d5:46:9b)-40814-1129061034355
getJMSTimestamp():
1129061034355
getJMSCorrelationID():
null
JMSReplyTo:
null
JMSDestination:
PhysicalQueue
getJMSDeliveryMode():
PERSISTENT
getJMSRedelivered():
false
getJMSType():
null
getJMSExpiration():
0
getJMSPriority():
4
Properties:
null
You will use the connection factory and queue you created in
Compiling and Packaging the MessageBrowser Client
To compile and package the MessageBrowser example using NetBeans IDE, follow these steps:
1. In NetBeans IDE, choose Open Project from the File menu.
2. In the Open Project dialog, navigate to
tut-install/javaeetutorial5/examples/jms/simple/.
3. Select the messagebrowser folder.
4. Select the Open as Main Project check box.
5. Click Open Project Folder.
6. Right-click the project and choose Build Project.
Writing Simple JMS Client Applications
Chapter 31 · The Java Message Service API
927