background image

Overviewof the sendremote Example

<< Deploys a Message-Driven Bean on Two Servers | Writing the Module Components >>
<< Deploys a Message-Driven Bean on Two Servers | Writing the Module Components >>

Overviewof the sendremote Example

You will find the source files for this section in
tut-install/javaeetutorial5/examples/jms/sendremote/. 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 979
in that the only components are a
client and a message-driven bean. However, the modules here use these components 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 server.
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.
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.
4. Each publisher publishes five messages.
5. Each of the local and the remote message-driven beans receives five messages and sends
replies.
6. The client's message listener consumes the replies.
Figure 32­4
illustrates the structure of this application. M1 represents the first message sent
using the local connection factory, and RM1 represents the first reply message sent by the local
MDB. M2 represents the first message sent using the remote connection factory, and RM2
represents the first reply message sent by the remote MDB.
An Application Example That Deploys a Message-Driven Bean on Two Servers
The Java EE 5 Tutorial · September 2007
986