} }

 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:

  1. Install Oracle WebLogic Server, including the examples.
  2. Start the Examples server.
  3. 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:

  1. Invoke the Administration Console in your browser.
  2. In the Domain Structure view in the left pane, select Services > Messaging > JMS Modules.
  3. Select the examples-jms module from the table of JMS Modules.
  4. 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).
  5. You can view the configuration by clicking the exampleTopic Connection Factory instance.

 

 

Build and Deploy the Example

  1. Set up your development shell, as described in Setting up your environment.
  2. 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

  1. Complete the steps in the "Prepare the Example" section.
  2. 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

  3. 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.

  4. To send messages to the topic, set up a new development shell and run the TopicSend client with the following command:
      $ ant run.send

  5. To end the program, send a quit message from the shell running the TopicSend client.

 

Troubleshooting


 

Related Topics

(Internet connection required.)