by Paco Gomez
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.
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.
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 service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi wlevs wlevs
#change to wlevs domain
keys Type Name Application
#list current directory
#show the explorer
Figure 1 shows a screenshot of these commands executed in wlshell.
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
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.
The ServerRuntime MBean provides an operation to shut down the server. The command to shut down the server is:
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
Figure 3. The Event Processing Language rule for
Figure 4 shows a sample interaction with the EPLProcessor MBean to add and delete EPL rules:
Figure 4. Retrieving, deleting, and adding rules using wlshell (click the image for a larger version)
The script used is:
app = helloworld
invoke getRule helloworldRule
invoke deleteRule helloworldRule
invoke addRule helloworldRule "select * from HelloWorldEvent retain 1 event"
As you can see, this provides full access to manipulating EPL rules.
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
set Message "Hi! the time is now:"
Figure 5 shows the wlshell output when executing the previous script:
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.
Figure 6. The output shows the modification immediately
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.
Paco Gómez is senior principal systems engineer at BEA Systems where he has been helping customers architecting solutions since 1999.