Java Reference
In-Depth Information
An Application Example That Deploys a Message-Driven Bean on Two
Servers
This section, like the preceding one, explains how to write, compile, package, deploy, and
run a pair of Java EE modules that use the JMS API and run on two Java EE servers.
These modules are slightly more complex than the ones in the first example.
The modules use the following components:
• An application client that is deployed on the local server. It uses two connection
factories, an ordinary one and one configured to communicate with the remote
server, to create two publishers and two subscribers and to publish and consume
messages.
• A message-driven bean that is deployed twice: once on the local server, and once
on the remote one. It processes the messages and sends replies.
In this section, the term local server means the server on which both the application
client and the message-driven bean are deployed ( earth in the preceding example). The
term remote server means the server on which only the message-driven bean is deployed
( jupiter in the preceding example).
You will find the source files for this section in the tut-install /examples/jms/
sendremote/ directory. Path names in this section are relative to this directory.
Overview of the sendremote Example Modules
This pair of modules is somewhat similar to the modules in “ An Application Example
That Consumes Messages from a Remote Server ” on page 429 in that the only compon-
ents are a client and a message-driven bean. However, the modules here use these com-
ponents in more complex ways. One module consists of the application client. The other
module contains only the message-driven bean and is deployed twice, once on each serv-
er.
The basic steps of the modules are as follows.
1. You start two Java EE servers, one on each system.
2. On the local server ( earth ), you create two connection factories: one local and
one that communicates with the remote server ( jupiter ). On the remote server,
you create a connection factory that has the same name as the one that communic-
ates with the remote server.
3. The application client looks up the two connection factories (the local one and the
one that communicates with the remote server) to create two connections, sessions,
publishers, and subscribers. The subscribers use a message listener.
Search WWH ::




Custom Search