|
WebLogic Server 7.0 Code Examples, BEA Systems, Inc. | |||||
See:
Description
| Class Summary | |
| JMSDrawDemo | This graphical example illustrates key concepts of the JMS publish/subscribe model. |
This graphical example illustrates key concepts of the JMS publish/subscribe model. Run the example to observe the behavior of transacted sessions, persistent messages, and durable subscribers.
Each JMSDrawDemo instance displays a canvas. When you click on a canvas, an icon is placed at that location and the mouse coordinates are published in a message and delivered to the JMS topic. When other instances of the application receive a message from the topic, they display an icon at the specified coordinates. As you click on one canvas, the other canvasses duplicate the arrangement of icons.
This graphical example illustrates key concepts of the JMS publish/subscribe model. Run the example to observe the behavior of transacted sessions, persistent messages, and durable subscribers.
The following sections describe how to:
build.xml file in the SAMPLES_HOME\server\src\examples\jms\drawdemo
directory, where SAMPLES_HOME refers to the
directory for all samples and examples for the WebLogic Platform.
prompt> antThe Java ant command builds the example and copies the files to the following directory:
SAMPLES_HOME\server\stage\examples\clientclasses\examples\jms\drawdemo
The following items have been preconfigured and/or predefined for your convenience:
Note: If you have configured the server to run the examples.jms.topic example, then no additional configuration changes are required to run the JMSDrawDemo example, and you can skip to the section Run the Example.
To configure the server:
prompt> ant runParameters contained within the run script are:
If you want each client window that you open to be unique, then you need to add a DurableSubscriberID . The durable subscriber ID allows you to try out persistence with durable subscribers. Each instance of the application must have a unique durable subscriber ID.
To do this, add a unique name after the URL in the run command inside the build.xml file. You must do this for every unique window that you open (you will see that name in the frame of the client window). So, for example, if you want to name the client "dilbert", you can change the build.xml run command to look like this:
<java classname="examples.jms.drawdemo.JMSDrawDemo" fork="yes" failonerror="true">
<arg line="t3://localhost:${PORT} dilbert">
Once it's running, the JMSDrawDemo application displays a command panel at the bottom of the window that allows you to:
Select the Persistent check box to enable persistent messaging. Persistent messages are of most interest to durable subscribers. You can establish a durable subscription by specifying the (optional) durable subscriber ID as the second argument on the command line. Select the Persistent check box to enable persistent JMS messages. Persistent messages that are sent when the subscriber is not active will be delivered when the subscriber reattaches--even after a WebLogic Server reboot.
Select the Transacted check box to turn on transacted mode. When the transacted mode is on, JMS does not send messages until you click the Commit button to commit the transaction, or click Rollback to roll back the transaction. To view a transaction commit operation, click several times on one canvas, then click Commit. The other canvasses are updated only after you click Commit.
Click Clear to send a clearScreen message to the topic. When the message is delivered, all instances of the application clear their canvasses.
Click Quit to quit the application.
|
Documentation is available at http://e-docs.bea.com/wls/docs70 |
|||||