Saturday, June 23, 2012

Configuring JMS Queues and Topics

Configuring JMS Queues and Topics

Overview

A JMS server implements the JMS infrastructure on a WebLogic server. Destinations (queues or topics) are targeted to a WebLogic server that has the JMS server configured.
In this tutorial you learn to configure a JMS server, a queue, and a topic . You will then post messages to the queue and topic and monitor them in the Administration Console. For reference.

Scenario

You are an application server administrator in the Dizzyworld Corporation. You have installed and configured the Oracle WebLogic Server for your enterprise. For information on how to install and configure Oracle WebLogic Server, please refer to these OBEs:

clip_image001[36]

Installing and Configuring Oracle WebLogic Server

clip_image001[37]

Configuring Oracle WebLogic Server Managed Instances

clip_image001[38]

Managing machines using the Administration Console

The Dizzyworld system architects decided to explore the JMS services by configuring a JMS server, a JMS module with JMS queue and JMS topic resources, and by deploying a simple messaging.war application to post messages to the queue and the topic..

clip_image002[7]

Prerequisites

Before you start the tasks, make sure that your system environment meets the following requirements:

Prerequisite tutorials:

Before starting this tutorial, you should complete the following prerequisite tutorials:

clip_image001[39]

Installing and Configuring Oracle WebLogic Server

clip_image001[40]

Configuring Oracle WebLogic Server Managed Instances

clip_image001[41]

Managing machines using the Administration Console

Minimum Hardware Requirements

Item

Specification

Processor Speed

1 GHz

Memory

2 GB

Free Hard Disk Space

1 GB

Software Requirements

The system should have installed the following products:

clip_image001[42]

Oracle WebLogic Server

Download the test_jms.zip file and save it in your machine where you would be performing the tasks.:Then extract the content in your local drive. In this sample, the files are extracted into /home/oracle/labs/wls103/testjms folder. The extract contains two files:

 

File Name

Description

1.

messaging.war

A simple Web application file used for testing the JMS queue and topics configured.

2.

deploy_testjms.py

A WLST script used for deploying the Web application.

Starting up the Servers in the Domain

The basic domain in this case consists of an Administration Server and a Managed Server (dizzy1). To start the two servers, perform the following steps:

1.

Invoke a new shell window and navigate to the bin subfolder under the folder where you have configured the domain For example:

$ cd /u01/app/oracle/product/Middleware/user_projects/domains/dizzyworld/bin .

2.

Run the startWebLogic.sh script to start the Administration Server..

clip_image003[7]

3.

When prompted :with “Enter username to boot WebLogic server”, enter the administrative user name you have setup when you created the domain. In this case user name “admin” is shown. Then enter the password for admin user when prompted with “Enter password to boot WebLogic server”.

clip_image004[4]

4.

This will start the Administration Server. Leave this shell window running..

clip_image005[4]

5.

To start the Managed Server (dizzy1) in the domain, invoke another shell window and navigate to the bin subfolder in your domain

6.

Execute the following command: to start the managed server.

$ ./startManagedWebLogic.sh dizzy1 http://localhost:7001

clip_image006[4]

7.

When prompted :with “Enter username to boot WebLogic server”, enter the administrative user name you have setup when you created the domain. In this case user name “admin” is shown. Then enter the password for admin user when prompted with “Enter password to boot WebLogic server

clip_image007[4]

8.

This would start up the Managed Server. Once again, leave this window as it is..

clip_image008[4]

Configuring JMS Server Using Admin Console

1.

Access the Admin Console and click JMS Servers under Services of Domain Configurations section. Then click Lock & Edit in the Change Center

clip_image009[4]

clip_image010[4]

2.

Click New under the JMS Servers table to create a new JMS Server.

clip_image012[4]

3.

Specify the following properties and click Next:

clip_image001[43]

Name

dizzyworldJMSServer

clip_image001[44]

Persistent Store

(none)

clip_image014[4]

4.

Select dizzy1 as the target JMS server. Click Finish.

clip_image016[4]

5.

Click Activate Changes to give effect to the changes.

clip_image017[4]

Configuring JMS Queue and Topic

1.

In the Admin Console, navigate to dizzyworld > Services > Messaging > JMS Modules.

Then click Lock & Edit in the Change Center.

clip_image018[4]

clip_image019[4]

2.

Click New on the JMS Modules table and specify the following properties and click Next

clip_image001[45]

Name

dizzyworldModule

clip_image001[46]

Descriptor File Name

dizzyworldModule

clip_image020[4]

3.

Select dizzy1 Managed Server as target. Click Next :

clip_image021[4]

4.

Select the checkbox for Would you like to add resources to this JMS system module and click Finish.

clip_image022[4]

5.

In the Settings for dizzyworldModule page, click the Subdeployments tab

clip_image023[4]

6.

In the Subdeployments table, click New. Enter dizzysubmodule as the Subdeployment Name and click Next

clip_image024[4]

7.

.In the Targets page, select the dizzyworldJMSServer as the target under the JMS Servers table. Click Finish

clip_image025[4]

8.

Click the Configuration tab.

9.

In the Settings for dizzyworldModule page under the Summary of Resources table, click New to configure a new JMS queue for the JMS module.

clip_image026[4]

10.

In the Create a New JMS System Module Resource page under Choose the type of resource you want to create, select Queue , and then click Next .

clip_image027[4]

11.

In the JMS Destination Properties, specify the following parameters and click Next

clip_image001[47]

Name

dizzyworldQueue

clip_image001[48]

JNDI Name

dizzyworldQueue

clip_image001[49]

Template

None

clip_image028[4]

12.

Select dizzysubmodule from the subdeployments list. Click Finish.

clip_image029[4]

13.

In the Settings for dizzyworldModule page, click New under the Summary of Resources table to configure a new JMS topic for the JMS module

clip_image030[4]

14.

In the Create a New JMS System Module Resource page, select Topic as the type of resource you want to create, and c lick Next. .

clip_image031[4]

15.

In the JMS Destination Properties, specify the following parameters, and click Next.

clip_image001[50]

Name

dizzyworldTopic

clip_image001[51]

JNDI Name

dizzyworldTopic

clip_image001[52]

Template

None

clip_image033[4]

16.

Select dizzyworldsubmodule from the subdeployments list. Click Finish.

clip_image035[4]

17.

Back in the Change Center, click Activatechanges

18.

Navigate to Home. In the home page, under Environment, click Servers to get to the Summary of Servers. In the table of servers, click dizzy1.

clip_image037[4]

19.

In the Settings for dizzy1 page, click View JNDI Tree

clip_image039[4]

20.

The JNDI Tree opens in another window or tab. In that tab notice the JNDI entries dizzyworldQueue and dizzyworldTopic under the dizzy1 managed server

clip_image041[4]

Customizing the Queue / Topic Display in Administration Console

1.

Access the Admin Console and click JMS Modules under Services section of Domain Configurations. Click dizzyworldModule link in the JMS Modules table.

clip_image043[4]

2.

Scroll down in the Configuration tab of Settings for dizzyworldModule. Click dizzyworldQueue link in the Summary of Resources table.

clip_image045[4]

3.

Click Monitoring tab in the Settings for dizzyworldQueue.

clip_image046[4]

4.

Click Customize this table in the Monitoing page..

clip_image048[4]

5.

Select Messages Total from Available column and click the right arrow to move it Chosen. Then click Apply.

clip_image050[4]

6.

Notice that Messages Total appears as one of the columns in the table. .

clip_image052[4]

Testing the working of JMS Queue and Topic

1.

Open a new shell window, navigate to the folder where you have the messaging.war application (for example: /home/labs/wls103/testjms folder).

clip_image054[4]

2.

Set WL_HOME environment variable to point to the location where you have installed WLS 10.3..

clip_image056[4]

3.

Run WL_HOME/server/bin/setWLSEnv.sh script to set up the environment variables.

clip_image058[4]

4.

Run the command java weblogic.WLST deploy_testjms.py to deploy the testds.war application.

clip_image060[4]

5.

Open a Web browser and navigate to http://localhost:7003/messaging

Using the application, post several messages to the standard queue and to the topic. Do not add messages to the distributed queue .

clip_image062[4]

clip_image063[4]

6.

In the Admin console navigate to dizzyworld > Services > Messaging > JMS Modules. In the JMS Modules table, click dizzyworldModule. In the Summary of Resources table, click dizzyworldQueue . and then click the Monitoring tab. Notice that the Messages High and Messages Total column show non zero values indicating new messages have been recieved. .

clip_image064[4]

7.

Repeat these steps to view the number to messages sent to the dizzyworldTopic .
Note: On the topic (unlike the queue), Messages High value remains zero, since there are no consumers connected to the topic, posted messages are automatically deleted from the server. For a queue, messages are saved on the server until they are consumed..

clip_image066[4]

 

.