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.

FIGURE 31–6 Sending Messages from One System to Another<br />

Queue<br />

Earth<br />

<strong>Java</strong> <strong>EE</strong> Server on Earth<br />

Producer<br />

Editing, Recompiling, Repackaging, and Running the Programs<br />

<strong>The</strong>se steps assume that you have the tutorial installed on only one of the two systems you are<br />

using and that you are able to access the file system of jupiter from earth or vice versa.<br />

After you create the connection factories, edit the source files to specify the new connection<br />

factory. <strong>The</strong>n recompile, repackage, and run the programs. Perform the following steps:<br />

1. Open the following file in a text editor:<br />

tut-installjavaeetutorial5/examples/jms/simple/producer/src/java/Producer.java<br />

2. Find the following line:<br />

CF that<br />

points<br />

to Jupiter<br />

CF<br />

@Resource(mappedName="jms/ConnectionFactory")<br />

3. Change the line to the following:<br />

@Resource(mappedName="jms/JupiterConnectionFactory")<br />

4. Recompile and repackage the Producer example on earth.<br />

If you are using NetBeans IDE, right-click the producer project and choose Clean and Build.<br />

If you are using Ant, type the following:<br />

ant<br />

5. Open the following file in a text editor:<br />

Sends<br />

Msg<br />

<strong>Java</strong> <strong>EE</strong> Server on Jupiter<br />

Queue<br />

Delivers<br />

Msg<br />

Jupiter<br />

tut-installjavaeetutorial5/examples/jms/simple/synchconsumer/src/java/SynchConsumer.java<br />

Writing Simple JMS Client Applications<br />

SynchConsumer<br />

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

CF

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

Saved successfully!

Ooh no, something went wrong!