}
}
Files
Prepare
Run
Troubleshooting
Related Topics
About the Example
This example shows how to establish a connection to a JMS topic, and send
and receive messages from that topic. The classes in this package operate on
the same JMS topic. Run the classes together to observe messages being sent
and received. This example demonstrates the behavior of a
non-durable subscriptions.
Files Used in the Example
Directory Location:
MW_HOME/wlserver_10.3/samples/server/examples/jms/topic/
(where MW_HOME is the directory containing your Oracle WebLogic Server installation)
File
Click source
files to view code.
|
Description
|
build.xml
| Ant build file that contains targets for building and running the example.
|
TopicReceive.java
| Client that demonstrates how to connect and receive messages from a JMS topic.
|
TopicSend.java
| Client that demonstrates how to connect and send messages to the JMS topic.
|
Prepare the Example
Prerequisites
Before working with this example:
- Install
Oracle WebLogic Server, including the
examples.
- Start
the Examples server.
- Set
up your environment.
Configure Oracle WebLogic Server
No special configuration is required for this example because the exampleTopic Connection Factory is preconfigured.
To verify that the Connection Factory is configured and deployed, follow the steps below:
- Invoke the Administration Console in your browser.
- In the Domain Structure view in the left pane, select Services > Messaging > JMS Modules.
- Select the examples-jms module from the table of JMS Modules.
- Observe that the weblogic.examples.jms.QueueConnectionFactory is targeted to the examplesServer and the Subdeployment is configured
as Default Targetting (the recommended
setting for Connection Factories).
- You can view the configuration by clicking the exampleTopic Connection Factory instance.
Build and Deploy the Example
- Set up your development shell, as described in Setting
up your environment.
- Execute the following command from
the shell where you set
your environment:
ant build
This command compiles and stages the example.
The Ant command uses the build.xml file,
located in the SAMPLES_HOME\server\examples\src\examples\jms\topic directory,
to build the example.
Run the Example
- Complete the steps in the "Prepare
the Example" section.
- With the examples Oracle WebLogic Server running, set
up a new development shell and run the TopicReceive
client with the following command:
$ ant run.receive
- To observe messages being sent to mutliple topic subscribers, set
up a new development shell and run another TopicReceive
client, as described in the previous step.
- To send messages to the topic, set
up a new development shell and run the TopicSend
client
with the following command:
$ ant run.send
- To end the program, send a quit message from the shell running
the TopicSend
client.
Troubleshooting
Related Topics
(Internet connection required.)