Writing the Module Components
Writing the Module Components
1. The administrator starts two Java EE servers, one on each system.
2. On the local server, the administrator deploys the message-driven bean module, which uses
a connection factory that specifies the remote server where the client is deployed.
3. On the remote server, the administrator places the client JAR file.
4. The client module sends three messages to a queue.
5. The message-driven bean consumes the messages.
illustrates the structure of this application. You can see that it is almost identical to
except that there are two Java EE servers. The queue used is the one on the remote
server; the queue must also exist on the local server for resource injection to succeed.
Writing the Module Components for the
consumeremote
Example
Writing the components of the modules involves
Coding the application client
Coding the message-driven bean
The application client, jupiterclient/src/java/SimpleClient.java, is almost identical to
the one in
Similarly, the message-driven bean, earthmdb/src/java/MessageBean.java, is almost
identical to the one in
The only major difference is that the client and the bean are packaged in two separate modules.
Java EE Server on Earth
EJB
Container
MDB Instance
Java EE Server on Jupiter
Application
Client
Sends
Msg
Delivers
Msg
Queue
FIGURE 323
A Java EE Application That Consumes Messages from a Remote Server
An Application Example That Consumes Messages from a Remote Server
The Java EE 5 Tutorial · September 2007
980