Creating Administered Objects for Multiple Systems

To run these programs, you must do the following:

Create a new connection factory on both earth and jupiter

Create a destination resource on both earth and jupiter

You do not have to install the tutorial on both systems, but you must
be able to access the filesystem where it is installed. You may find it more
convenient to install the tutorial on both systems if the two systems use
different operating systems (for example, Windows and Solaris). Otherwise
you will have to edit the file tut-install/javaeetutorial5/examples/bp-project/build.properties and change the location of the javaee.home property
each time you build or run a program on a different system.

To create a new connection factory on jupiter, perform
these steps:

From a command shell on jupiter, go to
the directory tut-install/javaeetutorial5/examples/jms/simple/producer/.

Type the following command:

ant create-local-factory

The create-local-factory target, defined in the build.xml file for the Producer example, creates
a connection factory named jms/JupiterConnectionFactory.

To create a new connection factory on earth that
points to the connection factory on jupiter, perform these
steps:

From a command shell on earth, go to the
directory tut-install/javaeetutorial5/examples/jms/simple/producer/.

Type the following command:

ant create-remote-factory -Dsys=remote-system-name

Replace remote-system-name with the actual
name of the remote system.

The create-remote-factory target, defined in the build.xml file for the Producer example, also
creates a connection factory named jms/JupiterConnectionFactory.
In addition, it sets the AddressList property for this
factory to the name of the remote system.

If you have already been working on either earth or jupiter, you have the queue and topic on one system. On the system
that does not have the queue and topic, type the following command:

ant create-resources

When you run the programs, they will work as shown in Figure 31–6. The program run on earth needs the queue on earth only in order that
the resource injection will succeed. The connection, session, and message
producer are all created on jupiter using the connection
factory that points to jupiter. The messages sent from earth will be received on jupiter.