background image

Running JMS Client Programs

<< The messagebrowser JAR | The Connection Factory >>
<< The messagebrowser JAR | The Connection Factory >>

Running JMS Client Programs

Running JMS Client Programs on Multiple Systems
JMS client programs using the Application Server can exchange messages with each other when
they are running on different systems in a network. The systems must be visible to each other by
name (the UNIX host name or the Microsoft Windows computer name) and must both be
running the Application Server. You do not have to install the tutorial examples on both
systems; you can use the examples installed on one system if you can access its file system from
the other system.
Note ­
Any mechanism for exchanging messages between systems is specific to the Java EE
server implementation. This tutorial describes how to use the Application Server for this
purpose.
Suppose that you want to run the Producer program on one system, earth, and the
SynchConsumer
program on another system, jupiter. Before you can do so, you need to
perform these tasks:
Create two new connection factories
Edit the source code for the two examples
Recompile and repackage the examples
Note ­
A limitation in the JMS provider in the Application Server may cause a runtime
failure to create a connection to systems that use the Dynamic Host Configuration Protocol
(DHCP) to obtain an IP address. You can, however, create a connection from a system that
uses DHCP to a system that does not use DHCP. In the examples in this tutorial, earth can
be a system that uses DHCP, and jupiter can be a system that does not use DHCP.
Before you begin, start the server on both systems:
1. Start the Application Server on earth.
2. Start the Application Server on jupiter.
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
Writing Simple JMS Client Applications
Chapter 31 · The Java Message Service API
931