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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Writing Simple JMS Client Applications<br />

924<br />

2. Run the Producer program, sending one message to the queue:<br />

appclient -client producer.jar queue<br />

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

Destination type is queue<br />

Sending message: This is message 1<br />

3. Go to the messagebrowser/dist directory.<br />

4. Run the MessageBrowser program:<br />

appclient -client messagebrowser.jar<br />

<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 />

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

5. Go to the synchconsumer/dist directory.<br />

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

appclient -client synchconsumer.jar queue<br />

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

<strong>The</strong> <strong>Java</strong> <strong>EE</strong> 5<strong>Tutorial</strong> • June 2010

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

Saved successfully!

Ooh no, something went wrong!