Java Reference
In-Depth Information
Note
Any mechanism for exchanging messages between systems is specific
to the Java EE server implementation. This tutorial describes how to
use the GlassFish Server for this purpose.
Suppose you want to run the
Producer
client on one system,
earth
, and the
SynchConsumer
client on another system,
jupiter
. Before you can do so, you need
to perform these tasks:
1.
Create two new connection factories
2.
Change the name of the default JMS host on one system
3.
Edit the source code for the two examples
4.
Recompile and repackage the examples
Note
A limitation in the JMS provider in the GlassFish 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.
When you run the clients, they will work as shown in
Figure 21-1
.
The client run on
earth
needs the queue on
earth
only so the resource injection will succeed. The con-
nection, session, and message producer are all created on
jupiter
using the connec-
tion factory that points to
jupiter
. The messages sent from
earth
will be received on
jupiter
.