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.

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

Reading message: This is message 2<br />

Reading message: This is message 3<br />

3. Now try running the programs in the opposite order. Right-click the synchconsumer project<br />

and choose Run.<br />

<strong>The</strong> Output pane displays the destination type and then appears to hang, waiting for<br />

messages.<br />

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

<strong>The</strong> Output pane shows the output of both programs, in two different tabs.<br />

5. Now run the Producer example using a topic instead of a queue.<br />

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

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

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

topic 3<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 topic<br />

Sending message: This is message 1<br />

Sending message: This is message 2<br />

Sending message: This is message 3<br />

6. Now run the SynchConsumer example using the topic.<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 />

topic<br />

d. Click OK.<br />

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

Writing Simple JMS Client Applications<br />

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

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

Saved successfully!

Ooh no, something went wrong!