Service Oriented Architecture (SOA) is increasingly important in software integration, and IBM® middleware such as WebSphere® Application Server, WebSphere Enterprise Service Bus (hereafter called WebSphere ESB), and WebSphere Process Server provide a solid basis for SOA architectures and applications. In addition, IBM Tivoli® Composite Application Manager for SOA (hereafter called ITCAM for SOA) provides powerful monitoring, controlling, and discovery features for SOA. This article describes a typical SOA management challenge and a solution based on WebSphere ESB and ITCAM for SOA.
A financial services company provides an interactive Web-based stock market service. The company wants to offer a high-quality stock quote service to premium (subscription) customers, and an intermittent quote service to standard customers during high-volume periods, as described below:
- When service performance is good, offer the real-time stock quote services to all customers
- When service performance drops below a predefined threshold during high-volume periods, offer the real-time stock quote services to premium customers only, and reject requests from standard customers.
This case presents these requirements:
- Create configurable runtime mediation to determine whether to accept or reject requests
- Monitor performance of back-end stock quote service
- When performance is degraded, take action to automatically modify mediation flow
Combining WebSphere ESB and ITCAM for an SOA solution
WebSphere ESB and ITCAM for SOA can meet these three requirements as follows:
- WebSphere ESB SCA mediation module and primitives provide flexible mediation, allowing configuration of routing rules.
- Managed SCA mediation primitives from ITCAM for SOA provide runtime configuration, while keeping all the features of the original SCA mediation primitives. ITCAM for SOA managed SCA mediation primitives are building blocks for the WebSphere ESB mediation module, which makes runtime decisions to accept or reject requests.
- ITCAM for SOA provides real-time performance monitoring of Web services on various application servers, including WebSphere (base and Community Edition), Microsoft® .NET®, SAP, JBoss, BEA WebLogic, and the AXIS SOAP engine in WebLogic.
- IBM Tivoli Monitoring, the framework on which ITCAM for SOA is built, provides policy function and a workflow editor
Here is the solution architecture:
Figure 1. Solution architecture
The mediation service that runs on WebSphere ESB is contained in a single mediation module, which consists of an export (SQService) that provides an interface for the requester, an import (RealtimeService) that binds to the external service providers, and a mediation flow component (SQMediation) that defines the mediation implementation. For information on how to create the mediation flow, see the WebSphere Integration Developer information center.
Figure 2. SCA mediation components
To perform the steps in this article, you need to configure the environment as shown below. For more information on any of these products, see Resources at the bottom of the article.
- Install WebSphere ESB V6 or WebSphere Process Server V6.
- Install WebSphere Integration Developer V6.
- Install Tivoli Monitoring V6.1 FixPack 4 or later.
- Install ITCAM for SOA V6.1 or later, including the mediation support tool.
- Although ITCAM for SOA can monitor many application servers, this example uses the WebSphere Application Server instance installed as part of WebSphere ESB.
Creating mediation with managed SCA mediation primitives
ITCAM for SOA managed SCA mediation primitives, delivered as an Eclipse plug-in, provide runtime configuration capability while keeping all features of the original WebSphere ESB SCA mediation primitives. The managed SCA mediation primitives are building blocks for the SCA mediation module. You need to install ITCAM for SOA managed SCA mediation primitives to WebSphere Integration Developer, and perform the following steps to create the mediation module to make the runtime decision to accept or reject requests:
Install ITCAM for SOA managed SCA mediation primitives
Install ITCAM for SOA managed SCA mediation primitives to WebSphere Integration Developer following the ITCAM for SOA Tools guide. If the managed SCA mediation primitives are installed successfully, you will find the icons in the red circle in the palette as shown below:
Figure 3: Managed SCA mediation primitives
Create Stock Quote Library, which defines the interfaces
- Create a library project named Resources.
- Get the WSDL file from the Download .zip file.
- Create the StockQuote mediation interface for export:
- Create the business objects SQRequest and SQResponse:
SQRequest attributes: name: symbol type:string name: customerID type:string SQResponse attribute: name: value type:float
- Create the Interface SQService as the export interface:
SQService operation: Operation name: getQuote Input(s): name: request type:SQRequest Output(s): name: response type:SQResponse
- Create the business objects SQRequest and SQResponse:
Create StockQuote SCA mediation module based on Resource Library
- 1 Create an SCA mediation module project named StockQuote and select Resource as the Required Library.
- 2 Create a mediation module with components as shown in Figure 2 above.
- 3 Generate Web service binding for SQService using SOAP/HTTP as the transport protocol. Port name is SQService_SQServiceHttpPort.
- 4 Implement the routing rule in SQMediation.
- a Implement request flow as shown below:
Figure 4. Request flow
Implement the switch logic in manager SCA mediation primitive, as shown below. In this example, assume CustomerA is a standard customer and CustomerB is a premium customer. When the request is from CustomerA (standard customer), the message is routed to Busy primitive and then rejected with a message. The Managed Message Filter: Manager looks like this:
Distribution mode: First Pattern: /body/getQuote/request/customerID[self::node()= CustomerA Terminal name: busy
Then implement the message transformation logic in the Adapter primitive as shown below. This transformation is to tailor the messages to match the back-end service interface.
Figure 5. Request message transformation
Then implement the Busy primitive by setting the Error Message to Server as too busy to respond.
- b Implement the response flow to transform the message to match the front-end service interface.
- a Implement request flow as shown below:
- 5 Export the StockQuote mediation module into an EAR file and deploy it in WebSphere ESB.
Enabling performance monitoring with ITCAM for SOA
ITCAM for SOA puts a data collector into the WebSphere environment to collect transaction performance data, summarize it, and present it in Tivoli Enterprise Portal in charts format. To enable Web services monitoring, do the following steps:
- 1 Make sure the front-end browser application and the back-end real-time stock quote Web service are installed correctly.
- 2 Stop WebSphere ESB.
- 3 Enable the ITCAM for SOA data collector on WebSphere ESB with commands similar to these:
C:\IBM\ITM\tmaitm6\KD4\bin\KD4configDC.bat -Cenable -Cenv 1 C:\IBM\WESB602 C:\IBM\ITM\tmaitm6\KD4\bin\KD4configDC.bat -Cenable -Cenv 9 C:\IBM\WESB602
- 4 Run some Web service traffic using URL: http://localhost:9080/StockQuoteSample/StockQuoteServlet:
Figure 6. Sample application Web page
- 5 After a few minutes, refresh the page, and you should see performance data on Tivoli Enterprise Portal:
Figure 7. Performance data on TEP
The upper left panel is the navigator tree. When you click the Performance Summary node, you see the Average Response Time by Operation view on the upper right, and the Service Inventory view on the button panel. The Service Inventory view shows the services discovered by ITCAM for SOA, with their detailed static information and latest status. Average Response Time by Operation shows the average response time in the last collection period (normally, ITCAM for SOA collects data every 5 minutes). You can see in Figure 7 that four pairs of services with the same operation name (getQuote) have been discovered. The first two pairs are SCA components; the third pair is the interface exported by the mediation module; and the last one (RealtimeServiceSOAP) is the real back-end service.
Creating policy with IBM Tivoli monitoring
You should understand the following concepts regarding Tivoli monitoring:
- Situation -- A defined set of conditions and actions that the Tivoli Monitoring agent has been configured to recognize and respond to (Take Action). A situation can be a simple monitor threshold with associated threshold values, or a more complex Boolean formula.
- Take Action -- To create and send commands to systems in your managed enterprise.
- Policy -- A set of instructions that lets you implement complex workflow strategies to incorporate advanced automation into your monitoring environment. Policies are designed, accessed, displayed, and created in the graphical Workflow Editor.
For more information, see Resources at the bottom of the article.
Create situations to evaluate the performance status
To view and modify this situation, open the Situation Editor: right-click the Performance Summary node and select Situations. You need to create two new situations as shown below: SQResponseTimeCritical (StockQuote back-end service performance is bad) and SQResponseTimeGood (StockQuote back-end service performance is good). To learn how to create a Situation, see the Tivoli Monitoring information center. After that, you need to associate and start the situation: right-click the ResponseTimeCritical_610 node, and select Associate / Start Situation.
- Situation SQResponseTimeCritical Formula:
(Average Elapsed Message Round Trip Time > 5000 AND Interval Status == Complete AND Operation Name (Unicode) == 'getQuote' AND Service Port Name (Unicode) == 'RealtimeServiceSOAP' AND Service Type == Requester)
- Situation SQResponseTimeGood Formula:
(Average Elapsed Message Round Trip Time <= 5000 AND Interval Status == Complete AND Operation Name (Unicode) == 'getQuote' AND Service Port Name (Unicode) == 'RealtimeServiceSOAP' AND Service Type == Requester)
Using Take Action to enable or disable the filter mediation
ITCAM for SOA provides ConfigureMediation_610 Take Action to enable or disable mediation. To run ConfigureMediation_610, go to the Mediation Configuration workspace, right-click, and select Take Action in the popup menu. Then select ConfigurationMediation_610 and fill in the blank spaces with the following attribute values. You can enable or disable mediation by setting Enabled=True or Enabled=False.
Figure 8. Take action -- ConfigurationMediation_610
Create a policy to enable mediation automatically when performance is below a predefined threshold
- Click the Workflow Editor icon on the toolbar to open the Workflow Editor.
- Create a new workflow such that:
When SQResponseTimeCritial is true, then run TakeAction. . .
(D4: kd4cm "Service_Component_Architecture,tive40:9443,StockQuoteApp:StockQuote: SQMediation,ManagedMessageFilter,Manager,Enabled=True")
. . . to enable the filter mediation.
When SQResponseTimeGood is true, then run TakeAction. . .
(D4: kd4cm "Service_Component_Architecture,tive40:9443,StockQuoteApp:StockQuote: SQMediation,ManagedMessageFilter,Manager,Enabled=False")
. . . to disable the filter mediation
- After creating this policy, distribute it to the correct environment and start it.:
Figure 9. Workflow -- SQPerformance
Testing the solution
A configuration file (C:\tmp\SQConfig.properties) is provided to configure the delay time of the back-end StockQuote service. You can modify the delay time to 6 seconds (DelayTime=6), which means that according to the policy, the SQResponseTimeCritical is fired, and the mediation is enabled. You can specify that Customer A (standard customer) cannot access stock price quotes, while Customer B (premium customer) can still use the service. If you change the DelayTime to a small number or just comment out the setting by adding # at the beginning of the line, then after invoking the service several times, SQResponseTimeGood is fired and the mediation is disabled.
Moving forward, you can create policy based on situations provided by other ITM agents and user-defined Actions.
- For example, when CPU use is too high, requests from standard customers are rejected:
Sample Situations provided by ITM operating system agent Situation C NT_Process_CPU_Critical Formula: (% Processor Time >= 90 AND ID Process == 3100)
- Another example is when performance is under a predefined threshold, you can send a message to the administrator's laptop:
Sample user defined Actions "net send machine1 BadPerformance'
This article described an SOA solution based on WebSphere ESB and ITCAM for SOA, and showed you how to configure it.
|Code sample||SQSample.zip||170 KB|
- WebSphere ESB developer resources page
Technical resources to help you use WebSphere ESB as a flexible connectivity infrastructure for integrating applications and services to support an SOA.
- WebSphere ESB product page
Product descriptions, product news, training information, support information, and more.
- WebSphere ESB information center
A single Web portal to all WebSphere ESB documentation, with conceptual, task, and reference information on installing, configuring, and using WebSphere ESB.
- WebSphere ESB documentation library
WebSphere ESB product manuals.
- WebSphere ESB FAQs
Basic questions and answers about the new WebSphere ESB product and its relationship to other WebSphere products.
- WebSphere ESB support
A searchable database of support problems and their solutions, plus downloads, fixes, problem tracking, and more.
- Redbook: Patterns: SOA Design Using WebSphere Message Broker and WebSphere ESB
Patterns for e-business are a group of proven, reusable assets that can be used to increase the speed of developing and deploying e-business applications. This Redbook shows you how to use WebSphere ESB together with WebSphere Message Broker to implement an ESB within an SOA. Includes scenario to demonstrate design, development, and deployment.
- Tivoli Monitoring information center
A single Web portal to information on deploying, installing, and configuring the common services components and the monitoring agents that make up the base Tivoli Monitoring product.
- Tivoli Composite Application Manager for SOA information center
A single Web portal to information on Tivoli Composite Application Manager for SOA.
- Tivoli Composite Application Manager for SOA, V6.1 User's Guide
A single Web portal to information on installing, configuring, and using Tivoli Composite Application Manager for SOA, V6.1 to monitor Web services on AIX, z/OS, Linux, Solaris, and Windows.
- Tivoli Composite Application Manager for SOA Tools, V6.1
A single Web portal to information on using Tivoli Composite Application Manager for SOA, V6.1 tools.
- developerWorks SOA and Web services zone
Technical resources for evaluating, planning, designing, and implementing solutions that involve SOA and Web services.
- WebSphere SOA solutions developer resources page
Technical resources for WebSphere SOA solutions.
- developerWorks WebSphere Business Integration zone
For developers, access to WebSphere Business Integration how-to articles, downloads, tutorials, education, product info, and more.
- WebSphere Business Integration products page
For both business and technical users, a handy overview of all WebSphere Business Integration products
- WebSphere forums
Product-specific forums where you can get answers to your technical questions and share your expertise with other WebSphere users.
- Most popular WebSphere trial downloads
No-charge trial downloads for key WebSphere products.
- Trial downloads for IBM software products
No-charge trial downloads for selected IBM® DB2®, Lotus®, Rational®, Tivoli®, and WebSphere® products.
- Technical books from IBM Press
Convenient online ordering through Barnes & Noble.
- developerWorks technical events and Webcasts
Free technical sessions by IBM experts that can accelerate your learning curve and help you succeed in your most difficult software projects. Sessions range from one-hour Webcasts to half-day and full-day live sessions in cities worldwide.