10.12.2012 Views

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>The</strong> output of the program looks like this:<br />

Message:<br />

Text: This is message 1<br />

Class: com.sun.messaging.jmq.jmsclient.TextMessageImpl<br />

getJMSMessageID(): ID:12-129.148.71.199(8c:34:4a:1a:1b:b8)-40883-1129062957611<br />

getJMSTimestamp(): 1129062957611<br />

getJMSCorrelationID(): null<br />

JMSReplyTo: null<br />

JMSDestination: PhysicalQueue<br />

getJMSDeliveryMode(): PERSISTENT<br />

getJMSRedelivered(): false<br />

getJMSType(): null<br />

getJMSExpiration(): 0<br />

getJMSPriority(): 4<br />

Properties: null<br />

Message:<br />

Class: com.sun.messaging.jmq.jmsclient.MessageImpl<br />

getJMSMessageID(): ID:13-129.148.71.199(8c:34:4a:1a:1b:b8)-40883-1129062957616<br />

getJMSTimestamp(): 1129062957616<br />

getJMSCorrelationID(): null<br />

JMSReplyTo: null<br />

JMSDestination: PhysicalQueue<br />

getJMSDeliveryMode(): PERSISTENT<br />

getJMSRedelivered(): false<br />

getJMSType(): null<br />

getJMSExpiration(): 0<br />

getJMSPriority(): 4<br />

Properties: null<br />

3. <strong>The</strong> first message is the TextMessage, and the second is the non-text control message.<br />

4. Run the SynchConsumer program to consume the messages.<br />

a. Right-click the synchconsumer project and choose Properties.<br />

b. Select Run from the Categories tree.<br />

c. In the Arguments field, type the following:<br />

queue<br />

d. Click OK.<br />

e. Right-click the project and choose Run.<br />

<strong>The</strong> output of the program looks like this:<br />

Destination type is queue<br />

Reading message: This is message 1<br />

Writing Simple JMS Client Applications<br />

To run the clients using the appclient command, follow these steps. You may want to use two<br />

terminal windows.<br />

1. Go to the producer/dist directory.<br />

Chapter 31 • <strong>The</strong> <strong>Java</strong> Message Service API 923

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!