WebLogic Event Server Administration with wlshell

by Paco Gomez
08/29/2007

Abstract

This tutorial shows how to perform BEA WebLogic Event Server (WLEvS) administration with wlshell. WLEvS exposes management operations through a standard JMX interface, including dynamic configuration of Event Processing Language (EPL) rules for application processors. The tutorial covers common management tasks related to server lifecycle, Event Processing Language rules, and adapter MBeans. The examples are provided using wlshell, a scripting shell that allows you to manage Java applications through their JMX interfaces.

Configuration

The management tasks described here are performed using WebLogic Event Server version 2.0 and wlshell version 2.1.0. The example used is the HelloWorld application included with WLEvS. By default, this domain has the JMX services enabled.

wlshell is a domain-specific programming language for JMX. It is a scripting shell fully compliant with the JMX specification, providing access to MBeans in a convenient manner.

Since both WLEvS and wlshell are based on standard JMX, the products interoperate directly out of the box, without any customization. WLEvS also includes another utility, wlevs.Admin, to access the MBeans and work with EPL rules.

wlshell can run on the same machine as WLEvS or remotely on another server. On the machine running wlshell, it is not necessary to install WLEvS. The only requirements are the wlshell install files and a valid JDK or JRE (version 5 or 6). Please refer to the wlshell installation documentation and the section about using the JMXRemote connector.

Connecting to WLEvS

We're going to start by connecting to the HelloWorld WLEvS domain using wlshell. Begin by starting the HelloWorld domain. In wlshell, use the connect command to connect to the WLEvS server, indicating the URL, username, and password, as shown here:

#connect
                        
connect service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi wlevs wlevs

#change to wlevs domain
com.bea.wlevs:

#set keys
keys Type Name Application

#list current directory
ls

#show the explorer
explore

Figure 1 shows a screenshot of these commands executed in wlshell.

wlevs connection

Figure 1. Using wlshell to connect to the server

We will be using the keys "Type," "Name," and "Application" for the rest of the tutorial, unless otherwise noted. The concept of "keys" is described in detail here.

wlshell also has a graphical explorer, shown in Figure 2. Here it displays the MBean server URL, available JMX domains, and all the MBeans registered on the com.bea.wlevs domain.

exploring wlevs

Figure 2. Using wlshell to investigate the com.bea.wlevs domain (click the image for a larger version)

The explorer provides a convenient way to browse the MBeans and see what attributes and operations are available.

Managing Server Lifecycle

The ServerRuntime MBean provides an operation to shut down the server. The command to shut down the server is:

cd /ServerRuntime
                        
invoke shutdown

or simply:

invoke /ServerRuntime/shutdown

Managing Event Processing Language Rules

Each processor inside an application has one corresponding MBean, which exposes EPL Rules management operations. Figure 3 shows the MBean for the helloworldProcessor in the helloworld application:

wlevs rules

Figure 3. The Event Processing Language rule for helloworld

Figure 4 shows a sample interaction with the EPLProcessor MBean to add and delete EPL rules:

wlevs rules management

Figure 4. Retrieving, deleting, and adding rules using wlshell (click the image for a larger version)

The script used is:

app = helloworld
                        
cd /EPLProcessor/${app}Processor/$app

get AllRules
invoke getRule helloworldRule
invoke deleteRule helloworldRule
get AllRules
invoke addRule helloworldRule "select * from HelloWorldEvent retain 1 event"
get AllRules

As you can see, this provides full access to manipulating EPL rules.

Accessing Other MBeans

WLEvS provides MBeans for many other components, like streams and application adapters. We can access their attributes and operations in the same way with wlshell.

As an example, the following script dynamically modifies the Message attribute of the helloworldAdapter:

cd /HelloWorldAdapterConfig/${app}Adapter/$app
                        
get Message
set Message "Hi! the time is now:"
get Message

Figure 5 shows the wlshell output when executing the previous script:

wlevs rule change

Figure 5. Modifying an attribute in an adapter (click the image for a larger version)

The change takes effect immediately, as seen in the WLEvS console output in Figure 6.

wlevs adapter mbean

Figure 6. The output shows the modification immediately

Summary

WebLogic Event Server provides all the management operations through the standard JMX interface. JMX-compliant tools, like wlshell, can be used to effectively administer WLEvS. In this tutorial we have described some basic management tasks, using MBean attributes and operations. Additional administrative tasks can be performed on other MBeans using the same techniques described here.

References

  • wlshell.net has a lot more information on the JMX scripting shell

Paco Gómez is senior principal systems engineer at BEA Systems where he has been helping customers architecting solutions since 1999.