此样本说明如何从 IBM Integration Bus 发出事件并在 WebSphere Business Monitor 中处理这些事件。样本将描述以下任务:
样本显示如何配置 WebSphere Business Monitor 以从 IBM Integration Bus 接收事件的演示:
样本基于以下场景:
一家园艺供应公司收到来自三种类型客户的采购订单请求:
收到的采购订单请求包含订购项,但不包含订购项的总价格。消息流将计算这个总价格并为金牌客户提供 15% 的折扣。金牌客户订单还由不同的服务服务应用程序进行处理,因此消息流将根据客户类型传递订单。
WebSphere MQ 输入队列 INPUT_ORDER_PRICE 接收采购订单请求。Compute 节点 ComputeOrderTotal 用于:
根据客户类型,输出请求将发送到以下一个 WebSphere MQ 输出队列:
消息集项目 WBMonitorEventsMessageSet 包含输入和输出消息的消息定义。
输入消息来自:
<?xml version="1.0" encoding="UTF-8"?>
<PO:purchaseOrder xmlns:PO="http://www.ibm.com/ProcessOrder" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ibm.com/ProcessOrder totalPOInstance.xsd ">
<PO:purchaseOrderID>11112222</PO:purchaseOrderID>
<PO:customerID>111111</PO:customerID>
<PO:customerType>GOLD</PO:customerType>
<PO:items>
<PO:item>
<PO:partNum>0239232</PO:partNum>
<PO:productName>compost</PO:productName>
<PO:quantity>14</PO:quantity>
<PO:price>4.99</PO:price>
</PO:item>
<PO:item>
<PO:partNum>0451481</PO:partNum>
<PO:productName>lawnmower</PO:productName>
<PO:quantity>10</PO:quantity>
<PO:price>79.99</PO:price>
</PO:item>
<PO:item>
<PO:partNum>0481257</PO:partNum>
<PO:productName>spade</PO:productName>
<PO:quantity>10</PO:quantity>
<PO:price>19.99</PO:price>
</PO:item>
</PO:items>
</PO:purchaseOrder>
输出消息来自:
<?xml version="1.0" encoding="UTF-8"?>
<PO:purchaseOrderPriced xmlns:PO="http://www.ibm.com/ProcessOrder" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ibm.com/ProcessOrder totalPOInstance.xsd ">
<PO:purchaseOrderID>11112222</PO:purchaseOrderID>
<PO:customerID>111111</PO:customerID>
<PO:customerType>GOLD</PO:customerType>
<PO:items>
<PO:item>
<PO:partNum>0239232</PO:partNum>
<PO:productName>compost</PO:productName>
<PO:quantity>14</PO:quantity>
<PO:price>4.99</PO:price>
</PO:item>
<PO:item>
<PO:partNum>0451481</PO:partNum>
<PO:productName>lawnmower</PO:productName>
<PO:quantity>10</PO:quantity>
<PO:price>79.99</PO:price>
</PO:item>
<PO:item>
<PO:partNum>0481257</PO:partNum>
<PO:productName>spade</PO:productName>
<PO:quantity>10</PO:quantity>
<PO:price>19.99</PO:price>
</PO:item>
</PO:items>
<PO:priceSummary>
<PO:itemTotal>1069.66</PO:itemTotal>
<PO:deliveryCharges>19.99</PO:deliveryCharges>
<PO:discount>163.44</PO:discount>
<PO:invoice>926.21</PO:invoice>
</PO:priceSummary>
</PO:purchaseOrderPriced>
请注意,输出消息上的根元素名称已由 Compute 节点更改为 purchaseOrderPriced。
监控在流中的以下节点进行配置:
要查看任何节点的详细信息,请打开消息流编辑器并选择“监视”选项卡。WebSphere Business Monitor 不监控访客订单,因此配置了一个事件过滤器以防止发出来自访客客户的事件。
在 MonitorModels.zip 文件中包含一个使用导出监控信息选项创建的样本监控模型 WBMonitorEvents_Model.mm
以下三个样本监控模型都包含在 MonitorModelsExamples.zip 文件中:
此模型是一般模型,可用于查看消息流的开始和结束并从任何服务器上运行的任意流回滚事件。模型包含的度量值保留来自事件的信息。关键业绩指标 (KPI) 显示流处理时间、活动、已完成(包括成功和失败的交易)、失败和成功交易的数量。
此模型使您能够查看在特定 Integration 节点上的特定服务器中运行的特定流的事件。过滤器使用 XPath 表达式进行设置,同时入站事件详细信息定义在监控模型上。 与 FlowGeneric 模型相同,已定义了某些包含来自事件的信息的度量值。 设置了过滤条件,以便过滤此样本中使用的 Integration 节点、服务器和消息流上的事件。您可以在 IBM Integration Designer 中打开“业务监视”透视图,以针对任何其他 Integration 节点、服务器或消息流更改入站事件过滤器,也可以选择根据其他度量进行过滤。
此模型用于样本的其余部分。 与 FlowSpecific 模型相同,此模型针对 Integration 节点、服务器和消息流名称进行过滤,而且此样本模型还创建使用触发器表达式的度量值,以使用消息有效内容中的以下元素来填充 WebSphere Business Monitor 出站事件:
您可以更改 WebSphere Business Monitor 入站事件 FlowStarted 和 FlowPriceSummary 的事件部分,从而抽取其他有效内容字段。
创建的 KPI 模型包含 KPI 上下文。 KPI 上下文包含针对模型和相关触发器及事件定义的 KPI。您可以从 MME 的“KPI 模型”页面查看这些触发器和事件。 以下是创建的一部分 KPI:
WBMonitorEvents_Model 监控模型
此模型是 ComplexContent 监控模型的一个版本,是使用工作台中的选项导出关于样本消息流的监视信息而创建的。
要找到如何从模型创建监控模型应用程序以及基于模型创建仪表板的方法,请参阅运行 WebSphere Business Monitor 样本。
要获取有关在 WebSphere Business Monitor 中创建监控模型的更多信息,请参阅
IBM WebSphere Business Process Management 信息中心。