Skip to main content

Put new capabilities of business activity monitoring (BAM) to work, Part 13: Publishing event messages to IBM WebSphere Business Monitor V6.1 with Web Services Notification

Enable Java clients to send events to WebSphere Business Monitor V6.1 through a Web service

Eric Wayne (ewayne@us.ibm.com), Senior technical staff member, IBM
Wayne photo
Eric Wayne is BAM lead architect, WebSphere Business Monitor development lead, and a core member of the IBM Software Group Architecture Board.
Wilfred Jamison, Ph.D., Senior Software Engineer and Manager, IBM, Software Group
Dr. Wilfred C. Jamison
Dr. Wilfred C. Jamison is a senior technical manager for the WebSphere Business Monitor development team at the IBM Research Triangle lab. He is currently involved in many projects within the Business Performance Management organization

Summary:  In this series, learn about the dramatic changes in IBM® WebSphere® Business Monitor V6.1—a major release that extends capability and simplifies how you monitor and manage the performance of your business. Monitoring your business activity is only effective when you have access to the business events that really matter. WebSphere Business Monitor is designed to accept and process events from any source. This article and the next (Part 14) explore a new option to send events to WebSphere Business Monitor through standards-based Web services. This article walks through an example that shows how Java™ Web services can use the WS-Notification standard to publish event messages to WebSphere Business Monitor. Part 14 shows how a similar approach can be used with .NET Web services for Microsoft® environments.

View more content in this series

Date:  23 Sep 2008
Level:  Intermediate PDF:  A4 and Letter (341KB | 19 pages)Get Adobe® Reader®
Activity:  2772 views
Comments:  

Introduction

IBM WebSphere Business Monitor V6.1 is a comprehensive business activity monitoring (BAM) solution that provides a near real-time view of your business performance. BAM can provide visibility into the performance of business activities by processing events, calculating business metrics, and presenting key performance indicators through business dashboards. Users can track current business performance against expectations and analyze trends over time.

The value of business monitoring increases with the number of business events to be monitored. One of the most important questions asked about any business monitoring solution is "How do I publish events from my application, message flow, or business process?" The following list summarizes a range of options for sending events to WebSphere Business Monitor. Common IBM products that serve as event sources:

  • WebSphere Process Server
  • WebSphere Business Services Fabric
  • WebSphere Enterprise Service Bus
  • WebSphere Business Events
  • WebSphere Message Broker
  • WebSphere MQ Workflow
  • IBM FileNet® P8
  • WebSphere DataPower® X150

Each of these products in turn offers a range of connectivity options. For example, you could use a WebSphere Adapter with WebSphere Enterprise Service Bus to get data from an application such as SAP, mediate the information into an event, and send it to WebSphere Business Monitor.

The applicable IBM product Infocenters have more information about configuring the product to produce events. The IBM Redbook Business Activity Monitoring with WebSphere Business Monitor V6.1 addresses various ways of sending events to WebSphere Business Monitor.

Though the above products and samples already provide wide coverage, many businesses will implement a portion of their overall business activity through other environments. What is the solution for getting events from these sources? This article and Part 14 describe an additional approach: using Web services to publish events from essentially any client application capable of being a Web service client. Because Web services provide platform and programming language flexibility, this approach will be valuable to many WebSphere Business Monitor customers.

Clearly, WebSphere Business Monitor offers many choices for obtaining events, as shown in Table 1.


Table 1. Recommended approaches for sending events
Event source DescriptionReferences
WebSphere MQ-enabled applicationsMany applications are already "MQ enabled," so a common approach is to route an event message to WebSphere Business Monitor through an MQ queue. "Enabling WebSphere Business Monitor V6.1 to receive events via WebSphere MQ" provides details.
Java applicationsThe best practice for gathering event data, mediating it into a business event, and sending the event to WebSphere Business Monitor is to use one of the IBM connectivity products listed above. In cases where this is not an option, you can create a custom emitter. A sample emitter is available. Business Activity Monitoring with WebSphere Business Monitor V6.1 provides a sample Java application that sends events from a simple file using Java application programming interfaces (APIs).
Database applicationsA best practice for obtaining events from a database is to use a connectivity product with the WebSphere Adapter for Java Database Connectivity (JDBC). If this is not an option, you could use a trigger from IBM DB2® or Oracle to detect a business change, mediate the data into an event, and send that event to WebSphere Business Monitor. WebSphere Business Monitor samples provides a sample DB2 event emitter.
Java Web serviceA custom application may benefit from using a standard Web service invocation for emission of a business event.This article
.NET Web servicesFor environments that make use of the .NET framework from Microsoft, and which are not integrated with one of the listed IBM products, a natural approach may be to send events using a Web service. Part 14 of this series.

This article and Part 14 focus on the last two options in Table 1: using Web services to publish events from essentially any client application capable of being a Web service client.

This configuration does not require changes to the mortgage lending monitor model sample used in this series.

This article begins with a short background on how events flow to WebSphere Business Monitor. An overview of the specific Web services standard used (WS-Notification, the OASIS standard for publishing messages) is provided. You will learn how to configure WebSphere Business Monitor to receive events through WS-Notification. You will also go through a sample WS-Notification producer that uses Java client bindings to send sample events to the mortgage lending model. The steps for configuring and enabling the flow of event information are included.

Part 14 describes how to use the same style approach with .NET clients. It shows how common Microsoft environments can serve as sources of business events for WebSphere Business Monitor.

How events flow to WebSphere Business Monitor

WebSphere Business Monitor server is built on J2EE and runs on WebSphere Application Server using a relational database such as DB2 or Oracle for persistence. Events are taken out directly by monitor model applications from a set of Java Messaging Service (JMS) queues—one input queue per monitor model application. WebSphere Business Monitor exploits the common event infrastructure (CEI) component of WebSphere Application Server for filtering and distribution of events to WebSphere Business Monitor JMS input queues. CEI then uses the messaging provider built into WebSphere Application Server V6 for the actual communication of messages to the monitor model queues. This messaging provider is called the service integration bus (SIBus), and it provides publish and subscribe functions to other server components and applications such as those written using the JMS.

Previous developerWorks articles have described other approaches for getting events to CEI. For example, "Enabling WebSphere Business Monitor V6.1 to receive events via WebSphere MQ" describes how to use WebSphere MQ-enabled applications to publish events to WebSphere Business Monitor.

This article focuses on using WS-Notification to publish an event message as input to CEI. In this case, CEI is still used for event filtering and distribution to the actual monitor model input queues. Hence, WS-Notification serves as a simple Web services interface in front of CEI.

The WS-Notification standard

For information about the standard itself, read ""Events and service-oriented architecture: The OASIS Web Services Notification specifications", and go to OASIS WS-Notification Technical Committee.

For details about various ways to use WS-Notification with WebSphere Application Server, read ""WS-Notification in WebSphere Application Server Version 6.1" and the Redbook Web Services Handbook for WebSphere Application Server 6.1 (Chapter 22).

WS-Notification has been described as “pub/sub for Web services.” WS-Notification is actually a family of related white papers and specifications, ratified through the OASIS standards body, that define a Web services approach to notification using a topic-based publish and subscribe pattern. The standards-based approach ensures that applications written by different vendors or teams can easily share information. Using Web services means that developers can write applications in a variety of languages and on different software platforms.

WS-Notification is actually composed of three separate specifications: WS-BaseNotification, WS-BrokereredNotification, and WS-Topics. Because WS-Notification has been available for several years, IBM and other vendors have produced a wide range of articles, documentation, and associated collateral for using the standard.

WebSphere Application Server 6.1 supports V1.3 of the WS-Notification family of specifications. For this article, we are interested in the specific case of sending events to WebSphere Business Monitor. WS-Notification in the WebSphere Application Server can be used in many more scenarios.

Interaction flow across components

To understand how to configure WebSphere Business Monitor to receive events through WS-Notification, first let's review the interaction of the two event and message components described earlier, SIBus and CEI. CEI uses SIBus in two ways:

  • CEI can receive event messages using SIBus through a JMS topic or queue.
  • CEI uses SIBus to publish event messages to JMS topics or queues using the filtering logic defined in CEI event groups.

SIBus messaging engines provide the actual delivery of event messages, and CEI provides an event abstraction for filtering and distribution based on event group expressions.

The next piece of the puzzle is how WS-Notification and SIBus can integrate. The WS-Notification implementation in WebSphere Application Server can be configured to use SIBus for messaging transport. You can configure the WS-Notification service to put a message on a SIBus topic or queue whenever the WS-Notification service Notify() operation is invoked by a client. With this in place, you can configure a flow of events from a WS-Notification producer to WebSphere Business Monitor, as shown in Figure 1.


Figure 1. Flow of event messages
Flow of event messages

Starting on the left side of Figure 1:

  1. A WS-Notification client, acting as producer application, creates an event, places the event into a NotificationMessage, and invokes the Notify() operation on the NotificationBroker interface exposed by the WS-Notification service configured in WebSphere Application Server.
  2. The WS-Notification service puts a message on a SIBus destination. This is configured through a defined relationship between the WS-Notification topic namespace and the SIBus topic space.
  3. CEI is configured to listen on the SIBus queue or topic. The CEI message-driven bean (included in CEI) is triggered when the message arrives.
  4. CEI filters based on event group definitions and publishes the event to the appropriate input destination for WebSphere Business Monitor.
  5. WebSphere Business Monitor processes the event.

Configuring WebSphere Business Monitor server for WS-Notification

You can use sample scripts in conjunction with this article to configure your WebSphere Business Monitor server to support the flow of event messages described above. The configuration scripts include two aspects:

  • General enablement of the WS-Notification service with integration to SIBus in WebSphere Application Server
  • Specific configuration of resources to flow events through SIBus and CEI to WebSphere Business Monitor

Step 1. Install and configure the SDO repository application in WebSphere Application Server

Because the example uses SIBus for enabling Web services, you need to use Service Data Objects (SDO) as the standard format to store and retrieve WSDL definitions. You need to create an SDO repository that can be implemented using a database engine of your choice. Instructions for this step are described in "Installing and configuring the SDO repository".

Step 2. Download configuration resources

A few resources, listed in Table 2, are included with this article. The Jython scripts and a properties file are in the monitor-wsn-downloads.zip file for you to download. Extract the files to a working directory.


Table 2. Resource files for configuring WS-Notification
FileDescription
configEventWSN.pyScript to set up necessary WS-Notification, JMS, SIBus, and CEI resources.
removeEventWSN.pyScript to uninstall the WS-Notification, JMS, SIBus, and CEI resources.
eventWSN.propertiesCommon resource names and properties used by the two scripts.

Step 3. Edit the eventWSN.properties file

Information about your environment is in eventWSN.properties. Make sure to edit this file so it reflects the properties that are unique to your environment.

#Cell, node and server name of the WAS installation:
crtCellName = 
crtNodeName = 
crtServerName = 
#Host where WAS is installed and the WAS HTTP_Transport Port:
host = 
wsnPort = 
#Path of the EventServiceMdb.jar file.
#This file should be located in EventServiceMdb.ear, which is usually
#located under the subdirectory tree under %WAS_HOME%/installedApps
#For example, when WebSphere Business Monitor toolkit is installed on WID 6.1, 
#the EventServerMdb.jar files is located under: 
#C:/IBM/WID61/pf/WBMonSrv_wps/installedApps/WBMonSrv_wps_Cell/EventService.ear
EventServiceMdb = 
      

Step 4. Run the configEventWSN.py script

wsadmin -f <path>/configEventWSN.py 
-lang jython <path>/eventWSN.properties -profileName <profile> 
-conntype=SOAP 

where:
<path> is the path where the scripts are.
<profile> is the name of the profile created for your monitor server, for example WBMon01.
wsadmin is located in %WAS_HOME%/bin.

The following snippet shows a sample execution of the script on a WebSphere Business Monitor unit test server installed in WebSphere Integration Developer.

c:\ibm\WID61\runtimes\bi_v61\bin\wsadmin -f c:\ibm\dev\WSN\scripts\configEventWSN.py 
-lang jython c:\ibm\dev\WSN\scripts\eventWSN.properties -profileName WBMonSrv_wps
-conntype=SOAP

Restart WebSphere Application Server for the definition of the bus and JMS JNDI resources to take effect.

If security is enabled on your WebSphere Business Monitor server installation, but you do not wish to use Web services security during your initial WS-Notification client testing, you can disable security on the CommonEventInfrastructure_Bus service integration bus.

When executed, the configEventWSN.py script performs the following actions, which result in the configuration shown in Figure 1.

  1. Creates a WS-Notification service.
  2. Creates an endpoint listener.
  3. Creates a WS-Notification service point.
  4. Creates an SIB destination for messages inbound to CEI.
  5. Creates a WS-Notification topic namespace.
  6. Creates a new JMS topic for messages inbound to CEI.
  7. Creates a new JMS topic that is used by CEI to publish to WS-Notification.

    This is not used for sending events to WebSphere Business Monitor. Rather, it can be used to publish events to other WS-Notification consumers.

  8. Creates a CEI event group profile used by CEI to publish to WS-Notification.
  9. Creates a new JMS activation spec for the message-driven bean inbound to CEI.
  10. Installs and configures the CEI message-driven bean.

Now you're prepared to develop and test your WS-Notification client to send events to WebSphere Business Monitor.

Developing a WS-Notification client as an event source

As mentioned, the IBM Redbook Web Services Handbook for WebSphere Application Server 6.1, Chapter 22, explains how to write WS-Notification applications using the WebSphere Application Server toolkit. This section covers the highlights specifically related to sending business events to WebSphere Business Monitor from a WS-Notification producer.

Table 3 summarizes the steps for creating and testing the event producer. The detailed steps follow the table.


Table 3. Steps to create and test the client
TaskTool
1. Export WSDL documents that describe the WS-Notification service.WebSphere Application Server administrative console
2. Create client application. Optionally, generate a Web services proxy to simplify the development of your producer.An integrated development environment (IDE), such as IBM Rational® Application Developer or the WebSphere Application Server toolkit
3. Edit client to populate a NotificationMessage with event data.An IDE, such as Rational Application Developer or the WebSphere Application Server toolkit
4. Add Java code to the client to invoke the Notify() operation of the NotificationBroker interface.An IDE, such as Rational Application Developer or the WebSphere Application Server toolkit
5. Run and test the client application, sending events to WebSphere Business Monitor. IDE, debugger, or command line execution of the application

Step 1. Export WSDL documents that describe the WS-Notification service

To begin, you need to retrieve the WSDL documents that describe the service you want to invoke from the client.

  1. From the WebSphere administrative console, select Service integration -> Web services -> WS-Notification services, then select the service to which you want to publish messages.
  2. From the Related Items list, select Notification broker inbound service settings.
  3. Under Additional Properties, select Publish WSDL files to ZIP file, as shown in Figure 2.

    Figure 2. Exporting WSDL for the Notification broker inbound service
    Exporting WSDL for the Notification broker inbound service

  4. Click the zip file name (for example, WSNServiceNotificationBroker.zip) and save it to a folder.

Step 2. Create client application

This example uses Rational Application Developer as the IDE. To generate a starting point client application:

  1. Create a J2EE client application project called WSNProducerClient.
  2. Create a folder under the parent project folder to contain the WSDL you exported in the previous step.
  3. Import the zip file containing the WSDL files to this new folder.
  4. The primary WSDL file of interest is CommonEventInfrastructure_Bus.WSNServiceNotificationBrokerService.wsdl. It contains the definition of the Notify() operation that you will invoke from the client.

    From within the J2EE perspective, right click on this WSDL file and select Web Services -> Generate Client, as shown in Figure 3.



    Figure 3. Launch Web service client wizard
    Generating a WS-Notification Client from the WSDL


    As you use the wizard, you can use the typical defaults. Be sure to choose Java Proxy as the client type, as shown in Figure 4.

    Figure 4. Generating a WS-Notification client from the WSDL
    Generating a WS-Notification Client from the WSDL

    After you complete the wizard, a number of new classes are created to serve as your Java proxy for the NotificationBroker. The classes are generated into the com.ibm.www package. A number of helper packages are also generated. A reference to the Web service is added to the deployment descriptor. Two of the important files are:

    • NotificationBrokerProxy.java - code that abstracts some of the more complicated aspects of invoking the service.
    • Main.java - where you insert new code for preparing and sending events.

The development and test resources in Table 4 are in the monitor-wsn-downloads.zip file.


Table 4. Sample files
FileComments
Main.javaSample Java application that uses the generated NotificationProxy to prepare and send events to WebSphere Business Monitor.
events.xmlSample Common Base Event (CBE) to use for testing.

Step 3. Edit client to populate a NotificationMessage with event data

You now have the basic structure of your producer application and are ready to add the logic to create and send messages. The full source code for this example can be found in Main.java, which you downloaded in the previous step. The following steps walk through snippets of the code.

First, focus on creating the necessary NotificationMessage object used as input to the Notify() operation of the Web service. Before going through the sample code, though, it's important to highlight that WebSphere Business Monitor expects to receive events with an event "header" that adheres to the CBE schema. The business relevant data for the event is placed in the "any" slot of the CBE header as an XML fragment.

The NotificationMessage data preparation steps are:

  1. Create the CBE data. In the example, we assume CBEs are contained in a file at path c:\\temp\\events.xml.
  2. Wrap the CBE into a SOAPElement.
    SOAPElement messageContents = soapFactory
      .createElement("CommonBaseEvents");
    messageContents.addNamespaceDeclaration("",
      "http://www.ibm.com/AC/commonbaseevent1_0_1");
    messageContents.addNamespaceDeclaration("xsi",
      "http://www.w3.org/2001/XMLSchema-instance");
    messageContents.setAttribute("xsi:schemaLocation",
      "http://www.ibm.com/AC/commonbaseevent1_0_1 commonbaseevent1_0_1.xsd");
    
    for (int i = 0; i < events.length; i++) {
      // update creation timestamps
      long delta = System.currentTimeMillis() - events[i].getCreationTimeAsLong();
      events[i].setCreationTimeAsLong(events[i].getCreationTimeAsLong() + delta);
    
      // update the global instance ID
      String globalInstanceId = (String) AccessController
    	.doPrivileged(new PrivilegedAction() {
    			public Object run() {
    				return EventFactory.eINSTANCE
    				.createGlobalInstanceId();
    	        }
      });
      events[i].setGlobalInstanceId(globalInstanceId);
    
      String foo = EventFormatter.toCanonicalXMLString(events[i], false);
      IBMSOAPFactory isf = (IBMSOAPFactory) soapFactory;
      SOAPElement sElement = isf.createElementFromXMLString(foo);
      messageContents.addChildElement(sElement);
    }       
    

  3. Create a NotificationMessage object, passing the SOAPMessageElement as a parameter to the constructor.
    // Create a notification message from the contents
    NotificationMessage message = new NotificationMessage(messageContents);
    

  4. Set the WS-Notification topic on the NotificationMessage.
    //	Add a topic expression to the notification message indicating to
    //	which topic(s) the message corresponds.
    Map prefixMappings = new HashMap();
    prefixMappings.put("topns", topic_ns);
    //  Constructor: TopicExpression(java.net.URI dialect, 
    //    java.lang.String topic, 
    //    java.util.Map prefixToNamespaceMappings
    TopicExpression exp = new TopicExpression(
      TopicExpression.SIMPLE_TOPIC_EXPRESSION,
      "topns:cei_wsn_topic", prefixMappings);
    message.setTopic(exp);
    

Step 4. Add Java code to invoke Notify() operation of the NotificationBroker interface

In this step, you add Java code to the client to add the actual invocation of the service. The example uses the generated proxy to simplify the client code.

// Since the Notify() operation expects an array of NotificationMessages, 
// wrap our single message into an array.
NotificationMessage nmArray[] = new NotificationMessage[] { message};      

// Create an instance of the generated proxy
NotificationBrokerProxy brokerProxy = new NotificationBrokerProxy();

// Perform the invocation
brokerProxy.notify(nmArray, optionalInformation);

Step 5. Run and test the client application, sending events to WebSphere Business Monitor

If you are using the Main.java file provided with this article, be sure to also place a copy of the provided events.xml file in the C:\TEMP directory on your file system.

There are two options for running the producer client application:

  • Export the enterprise application project to an EAR file and use the launchClient command to run the application in the client container.
  • Run the client in the workspace. Select the WSNProducerClient project, then select Run As - Run.

You should verify that the flow of event messages has reached WebSphere Business Monitor. If you used the example events.xml file, and you deployed and configured the MortgageLendingBAM sample that ships with WebSphere Business Monitor 6.1, after you run the producer client application you should be able to launch a WebSphere Business Monitor dashboard and see the instances view updated similar to Figure 5.


Figure 5. Instances view populated from events
Instances View Populated from Events

Summary

In this article, you learned about an additional approach for sending business events to WebSphere Business Monitor. You can employ Web services to emit events when you do not already have your business processes and activities integrated with one of the IBM products enabled to send events to WebSphere Business Monitor.

In Part 14 of this series, learn about applying this approach for .NET environments.

Acknowledgments

The authors would like to thank Jaime Atiles, Joachim Frank, and David Eads for reviewing this article.



Download

DescriptionNameSizeDownload method
Samples for this articlemonitor-wsn-downloads.zip13KB HTTP

Information about download methods


Resources

Learn

Get products and technologies

Discuss

About the authors

Wayne photo

Eric Wayne is BAM lead architect, WebSphere Business Monitor development lead, and a core member of the IBM Software Group Architecture Board.

Dr. Wilfred C. Jamison

Dr. Wilfred C. Jamison is a senior technical manager for the WebSphere Business Monitor development team at the IBM Research Triangle lab. He is currently involved in many projects within the Business Performance Management organization

Comments



Trademarks  |  My developerWorks terms and conditions

Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Sample IT projects, WebSphere, Architecture
ArticleID=340458
ArticleTitle=Put new capabilities of business activity monitoring (BAM) to work, Part 13: Publishing event messages to IBM WebSphere Business Monitor V6.1 with Web Services Notification
publish-date=09232008
author1-email=ewayne@us.ibm.com
author1-email-cc=aldiaz@us.ibm.com
author2-email=wjamison@us.ibm.com
author2-email-cc=

My developerWorks community

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Special offers