决策树流程_实施更智能的流程决策

决策树流程

业务流程管理系统和决策管理解决方案自然是互补的。 当您查看业务流程管理解决方案时,关键服务类型包括人员服务,集成服务,系统服务和决策服务。 决策服务支持多种功能,包括验证,数据充实,聚合,计算,扩展逻辑功能以及其他关键流控制方面。 实际上,所有过程都取决于决策。

如果您对规则和决策管理方面感兴趣,那么有两本非常好的关于决策服务的书:

  • James Taylor,决策管理系统:使用业务规则和预测分析的实用指南,2011年,IBM Press
  • Jerome Boyer和Hafedh Mili,《敏捷业务规则开发:流程,体系结构和JRules示例》,2011年

本教程重点介绍在使用不断发展的IBM BPM解决方案实施规则时要考虑的标准。 如果您正在寻找有关IBM BPM和IBM ODM之间的基础集成方面的详细技术信息,请确保查看Jerome Boyer 设计和实施决策服务最佳实践 。 本教程提供了为IBM BPM和决策管理选择适当的解决方案方法的指导,但并未取代最佳实践系列中广泛的详细技术内容。

在几乎所有情况下,建议使用单独的规则系统来开发和部署决策服务。 这种方法的原理很简单–业务敏捷性取决于可扩展和可扩展的决策自动化,这通常建议使用单独的业务规则管理系统(BRMS)。 通过在实施IBM BPM-IBM ODM解决方案时采用正确的做法,开发人员可以优化灵活性和响应能力,以响应业务所需的更改。

业务流程管理和规则的演变

传统的业务流程管理解决方案通常要求决策服务以代码实现。 因此,决策服务与第一代业务流程管理解决方案中的应用紧密耦合。 基本决策的任何更改都需要开发,测试和部署新版本的流程应用程序。 实际上,许多当前的业务流程管理解决方案仍然使用嵌入在流程应用程序中的规则来使用户使用此开发模型,这有点令人恐惧。

在某些情况下,有些决策应直接在流程应用程序中实施。 示例包括字段级验证,简单的路由决策以及其他静态和简单决策服务。 但是,在大多数情况下,直接在IBM BPM中开发规则会给支持用于实施和管理决策的灵活方法带来很大的限制。 IBM BPM提供了基本的嵌入式规则功能,可以开发if-then-else规则,该规则支持基于流程应用程序数据模型管理词汇表的能力。 嵌入式规则功能允许创建操作规则(基于IBM ODM软件开发工具包)。 IBM BPM中的嵌入式决策表功能不使用软件开发套件。 通常,使用嵌入式功能实现规则的用例是有限的。 在大多数情况下,如果开发人员决定不使用完整的BRMS(例如IBM ODM),则应使用JavaScript来开发基于代码的规则。 本教程说明了如何提供一套文档齐全的模式来将规则集成为单独的体系结构组件,这是决策管理的一项基本功能。

在过去的几年中,出现了第二代流程体系结构,该体系结构侧重于将决策服务实现为一种分离的流程规则解决方案。 IBM Smarter Process平台举例说明了这种方法,并且是企业级BRMS新兴要求的自然扩展。 使用IBM WebSphere Operational Decision Management做出更好的决策 IBM Redbooks出版物是了解BRMS原理的有用指南。

由于基于规则的模式将决策服务划分为单独的规则应用程序,因此,如果决策逻辑发生更改,它们将提供更大的灵活性和适应性。 结果,在IBM ODM中开发规则集并在IBM BPM中支持与SOAP-XML或REST-XML和JSON Web服务的松散耦合集成模式,是一种在业务流程应用程序中管理动态决策的更干净,更体系结构合理的方法。

考虑何时使用IBM ODM或嵌入式IBM BPM规则的体系结构决策。 以下各节和解决方案示例重点介绍这些决策。

基于IBM BPM的决策服务的选项

考虑以下用于在IBM BPM应用程序中实现决策服务的选项:

  • JavaScript或Java(基于代码)–这种模式涉及使用标准代码来开发规则或决策,或者通过JSAPI或潜在地从流程应用程序中调用Java对象。 尽管可以使用Java,但它需要进行其他配置才能将Java工件与流程应用程序集成在一起。 JavaScript提供了一种更简单的方法,因为该组件可以作为流程应用程序的一部分直接执行。 但是,JavaScript通常不是决策服务的良好实现方法,正如您将在本教程的后面部分看到的那样。 如果开发人员确实决定直接在IBM BPM解决方案中实施规则而不使用IBM ODM,则建议使用基于代码的解决方案(例如JavaScript)。
  • IBM BPM规则– IBM BPM包含一个嵌入式规则引擎,如前所述。 IBM BPM中的规则通过嵌入式IBM ODM编辑器启用,该编辑器提供了一个易于使用的界面,用于使用业务操作语言(BAL)创建规则。 此开发功能是使用IBM ODM技术构建的。 规则解决方案允许创建基本的“其他规则”(称为“动作规则”)和决策表。 《 使用IBM Business Process Manager V8.0改进流程的设计和部署》 IBM Redbooks出版物以及IBM Knowledge Center中的IBM BPM文档进一步描述了这些功能。 在大多数情况下,对于在IBM BPM中实施规则,建议不要使用此选项。
  • IBM ODM –您可以使用IBM ODM外部化规则并将其作为单独的工件进行管理。 在大多数情况下,这是实施大多数决策服务的首选解决方案。 此选项是本教程其余部分的重点。

将规则外部化为IBM ODM的关键条件

在决定外部化规则并在IBM ODM中管理它们时,要考虑五个标准。

复杂

考虑所需决策的潜在复杂性和复杂性。 尽管IBM BPM中的操作规则和决策表允许创建规则,但是IBM BPM中没有规则编排的概念。 在IBM ODM中,规则流为将多个规则链接在一起提供了一种优雅的解决方案。 使用IBM BPM,更改多个规则是通过IBM BPM规则工件(例如,操作规则和决策表)完成的,并且每个后续任务都需要映射业务变量作为实现的一部分。 结果,很难(但不是不可能)在IBM BPM中开发和维护复杂的规则。 IBM BPM嵌入式规则可用于支持简单的验证和转换,但是使用IBM ODM可以更轻松地设计和管理复杂的决策。 如果您的环境具有以下任何复杂性,请考虑使用IBM ODM:包含大量变量或大量规则的决策服务,需要根据合规性将规则作为单独版本进行管理的规则,规则推论的要求(支持用例,其中规则修改规则数据对象并要求规则重新评估),区域变化或其他影响执行点潜在规则工件选择的因素。

例如,当前的IBM客户评估了用于在IBM BPM中开发开户应用程序的选项。 我们的IBM团队最初考虑将嵌入式规则功能与IBM BPM一起使用,但是功能要求表明需要编排多个规则以执行资格,并需要围绕潜在账户选项的决策来提供给请求新账户的实际客户。 我们发现,使用IBM ODM启用规则链接可以为实施决策提供更清洁,更易管理的解决方案。

生命周期管理

简而言之,与嵌入式规则相比,外部规则更容易更改。 通过将规则移到单独的逻辑容器中,与直接嵌入到流程应用程序中的规则相比,可以更快速,更低成本地管理和部署规则。 将规则放置在IBM BPM嵌入式规则解决方案中要求更改规则需要重新部署基础流程应用程序。

决策要求经常频繁变化。 通过在单独的开发生命周期中对其进行管理,组织可以在响应业务需求方面提供更高的灵活性。 如图1所示,将规则作为决策服务生命周期的一部分进行管理,可以快速部署规则而无需重新部署应用程序。

图1.规则管理生命周期
规则管理生命周期

该图显示可以独立管理决策服务和业务流程的生命周期。 可以根据业务需求的变化和发展来修改决策。 决策和流程可以有效地异步管理。 负责管理决策和策略的团队以及策略管理者可以根据市场趋势,法规要求或其他影响决策服务定义的更改来设计和部署新规则,独立于流程应用程序生命周期执行这些功能。 在外部化规则系统中维护规则,使您可以控制基本应用程序外部的决策更改。

此外,外部化规则可以将决策服务的测试和管理作为单独的任务进行,从而提高了规则工件的质量和可靠性。 例如,管理法规遵从性规则的单独治理策略通常受制于不同的开发人员和业务用户。 使用BRMS可以将决策作为一组单独的任务进行更改和部署,并且可以在面对合规性要求变更时提高敏捷性。

尽管组织可以使用IBM BPM工具箱来管理IBM BPM嵌入式规则,但是该选项仍然需要重新部署工具箱和相关的测试需求,这并不敏捷。 通过在IBM ODM中维护规则,可以在数分钟而不是数月内部署规则更改。 对于经常更改的规则和决策,这种部署优势尤其重要。

例如,IBM客户使用IBM ODM通过无数种不同的渠道(包括ATM,Web和移动界面)管理客户的报价。 报价经常更改。 通过从需要报价管理集成的各种应用程序中外部化规则,组织可以根据新事件和市场趋势快速更改报价。 IT团队通常每周都要重新部署两到三个规则应用程序。 该要求要求基于IBM ODM的方法必须确保采用灵活敏捷的方法来进行动态商品管理。

重复使用决策服务

在许多情况下,决策服务必须由多个应用程序使用。 如果这些应用程序都是IBM BPM应用程序,则可以在IBM BPM工具箱中管理决策服务。 但是,大多数时候,其他应用程序(例如Web应用程序和数据管理应用程序)也需要启用对这些决策服务的访问。 在许多情况下,将来可能还有其他需要决策服务的应用程序,开发初始应用程序时可能不知道。 挑战显而易见:要么使用诸如IBM ODM之类的工具集中管理决策服务,要么在需要它们的每个应用程序中设计和部署规则工件。 除了前面讨论的生命周期开发和测试问题以外,主要风险是确保需要做出的决策的一致性。 如果您在多个应用程序中具有“复制”功能,则该方法要求每个应用程序必须确保规则一致。 随着决策变得更加复杂或易变,授权变得更加困难。 前期开发成本不是关键挑战。 真正的问题是在各种应用程序中更改规则的每个实例所需的相关维护和治理,以及如果在整个企业范围内未统一管理和更改规则,则可能导致数据和应用程序不一致的潜在风险。

重用的示例涉及一个IBM银行客户,该客户在IBM ODM中提供贷款资格规则。 此功能用于为零售,小型企业,公司和财富管理客户提供服务的四个不同应用程序中。 小型企业贷款管理应用程序是在IBM BPM中开发的。 通过在IBM ODM中提供决策,客户端可以将规则维护为共享组件,从而确保实现此决策集的所有应用程序都使用相同的受控规则集。

业务和IT协作

业务用户通常对应用程序实现的细节不感兴趣。 但是,他们通常希望在规范,测试和决策管理中保持积极的作用。 业务用户在规则,策略的设计,开发,测试和部署中起作用的能力是许多业务应用程序中的最佳功能。

在最基本的级别上,IBM BPM和IBM ODM中的业务规则和决策是以直观的语言编写的,业务用户很容易理解。 这种简单的方法在业务和IT部门之间提供了更高水平的潜在协作。

使协作更进一步:在许多情况下,业务用户需要直接访问规则和决策服务以查看决策,并且在某些情况下需要修改和扩展规则的能力。 通常,规则的修改是作为正式和受控的治理和发布策略的一部分进行管理的,但是在很多情况下,知识工作者被授予有限的决策服务管理权。 如果将规则嵌入到应用程序中,则可以授予有限的管理权限,但是它需要创建两个用户界面组件来支持此功能。 更重要的是,对嵌入式规则的修改缺少确保规则质量和一致性所需的必需的治理和发布管理过程。 IBM ODM为治理以及发布和部署管理提供集成支持,以确保业务用户发起的修改的一致性和准确性。

在IBM ODM的Decision Center中,您可以以受控和受管的方式为业务用户提供访问和更改管理功能。 在IBM ODM V8.7中,此功能已扩展为包括业务用户测试和规则模拟,以及用于规则生命周期管理的受管方法。 无需定制开发。 在业务团队中的主题专家需要具有根据行业和市场趋势的变化来更改决策的能力的行业中,此功能正变得越来越重要。

例如,我们的IBM团队最近与客户一起设计了付款处理解决方案。 客户使用决策中心使业务用户可以查看付款处理决策,并允许特定业务用户修改决策。 IT团队专注于应用程序实施方面,并以咨询角色为业务用户服务,以确保做出正确的决策并支持决策的规则治理。

规则范围和设计也出现了类似的要求。 业务用户希望参与决策服务的初始需求分析和设计过程。 作为Smarter Process的一部分,IBM Blueworks Live为用户提供了对决策进行建模的能力,这在使用IBM Blueworks Live IBM Redbooks 发现业务流程中的决策中进行了讨论。 对象管理小组(OMG)将Blueworks Live映射到新兴工作中,以开发决策建模表示法(DMN)标准。 此功能提供了必需的功能,以使业务和IT部门可以协作进行决策服务设计和开发。

决策服务管理和可见性

通过在规则系统(例如IBM ODM)中从外部管理规则,可以启用以下附加功能,这些附加功能可以为决策服务提供辅助好处:

  • 使用IBM ODM进行规则的设计和开发可以集中管理决策服务的编写和测试,这是与应用程序分开的功能。 此功能使开发人员能够支持其他模拟功能,例如冠军挑战和假设分析。
  • 规则的集中管理提供对决策的直接治理,并帮助确保按功能,域以及用户和开发人员角色在多个应用程序中决策的一致性和有效性。
  • IBM ODM中的“决策仓库”工具使组织能够支持审计和决策操作的可见性,例如确定做出哪些决策以及何时做出决策。 这对于提供监管和合规运营的决策尤其重要,因为需要进行内部和外部审核才能对决策结果进行监督和分析
  • 同时,重要的是要认识到将规则外在化不是万能药。 通过将流程决策外部化为IBM ODM,架构师和开发人员必须理解以下概念:
    • 在IBM ODM中执行规则会导致处理决策的额外呼叫开销,并且要求IT团队根据需求评估不同的IBM ODM部署方法。 请参阅Jerome Boyer设计和实施决策服务的最佳实践系列,以了解应考虑的选项。
    • IBM ODM中的实施规则在运营解决方案体系结构和持续管理的实现中涉及额外的解决方案复杂性,例如由于端到端解决方案中需要使用诸如Decision Server之类的附加组件而导致可用性和性能管理。

请注意,在设计和实施解决方案时,可以通过良好的架构实践和对关键架构决策的前期评估轻松地缓解这两个挑战。

最后要考虑的是,比较IBM BPM嵌入式规则功能和在IBM ODM中实现规则,可以将嵌入式规则迁移到IBM ODM。 如IBM BPM文档中所述,可以将IBM BPM应用程序中的嵌入式规则导出到规则项目中,然后导入到IBM ODM Rule Designer中。 通过支持规则流和通用词汇表,迁移功能扩展了规则功能。 但是,每个操作规则都作为单独的项目导出。 考虑一下影响:如果您有10条操作规则,这将导致10条规则项目具有单独的业务对象模型,这是站不住脚的。 这种方法通常要求开发人员必须重构并重新实施决策。 如果在建议的IBM BPM应用程序范围内和设计的决策中存在先前描述的决策标准,则最好从IBM ODM规则方法开始。

安装库存评估IBM ODM应用程序

您必须先安装IBM ODM应用程序,然后在IBM BPM中导入并配置流程应用程序,然后才能运行本教程中的“库存评估”流程示例。 本教程要求您已经安装了IBM BPM V8.5.x和IBM ODM V8.7。

首先,安装IBM ODM Rules应用程序。 转到本教程的“下载”部分,下载code_sample.zip并解压缩文件。 您会看到以下文件:

文件 描述
Stocks Demo – rules.zip 对应于使用了Decision Services Main规则项目的工作空间
ruleApp_StocksDemoRuleApp_1.0_ ddMonthYYYY .jar ,例如ruleApp_StocksDemoRuleApp_1.0_19Feb2015.jar 对应于可以直接部署到Rule Execution Server的RuleApp文件。
res-request-1.xml
res-request-2.xml
res-request-3.xml
使用Rule Execution Server中的REST Test选项测试决策服务的示例请求

然后,使用以下两个选项之一测试规则应用程序:

  1. 仅Ruleapp部署:这允许从任何Web服务客户端或提供的IBM BPM应用程序执行StocksDemoRuleApp
  2. 将工作空间导入Rule Designer中并进行部署:这提供了上一部分中描述的所有规则资产详细信息。 从Rule Designer中,可以将规则项目与Decision Center同步并部署到Rule Execution Server。

选项1:部署StocksDemoRuleApp

要仅部署规则应用程序,请完成以下步骤:

  1. 登录到Rule Execution Server控制台(例如: http://localhost:9080/res )。
  2. 选择资源管理器
  3. 在RuleApps视图部分中,单击Deploy Ruleapp Archive
  4. 浏览找到您下载并保存的ruleApp_StocksDemoRuleApp_1.0_dd_MonthYYYY.jar文件。
  5. 保留默认值,然后单击Deploy
  6. 确认在ruleapps区域中列出了StocksDemoRuleapp文件。

完成以下步骤以测试规则应用程序:

  1. 登录到Rule Execution Server控制台(例如: http://localhost:9080/res )。
  2. 选择资源管理器标签。
  3. 从RuleApps列表中,单击StocksDemoRuleApp规则应用程序名称。
  4. RuleApps视图部分中,单击StocksDemoRuleset规则集名称。
  5. 在“规则集”视图中,选择“ 检索HTDS描述 文件” 。 从“检索HTDS描述文件”部分,确保选择了以下选项,如图2所示:
    • REST即服务协议类型
    • 最新规则集版本
    • 最新规则应用程序版本
    图2.检索HTDS描述文件
    检索HTDS描述文件
  6. 点击测试 。 一个新窗口将打开,其中包含两个部分:“执行请求”和“服务器响应”。 确保为执行请求选择了XML
  7. 将执行请求的内容替换为下载的代码示例中XML文件之一的内容,例如: res-request-1.xml
  8. 点击执行请求
    服务器响应现在应该具有执行结果。

    有关更多信息,请参阅IBM Knowledge Center上的IBM ODM文档:

选项2:将工作空间导入规则设计器

要将工作空间导入Rule Designer中并部署规则项目,请完成以下步骤:

  1. 在临时位置中提取Stocks Demo – rules.zip文件,其中包含工作空间,例如: c:\temp\devworks
  2. 打开规则设计器。
  3. 选择工作空间位置,例如: c:\codes\bpmodm
  4. 选择文件 > 导出
  5. 在导出窗口中,展开“ 常规”部分,然后选择“将现有项目导入工作区”选项。
  6. 单击下一步
  7. 在“ 选择根目录”部分中浏览提取工作空间文件内容的位置。 确保选中“ 将项目复制到工作区”复选框。
  8. 点击完成 。 “ 股票-演示-规则”规则项目应显示在左侧的“规则浏览器”部分。
  9. 要将项目与决策中心同步,请完成以下步骤:
    1. 选择“ 股票-演示-规则”规则项目。
    2. 右键单击并选择决策中心 > 连接
    3. 提供连接信息,例如:
      • 网址: http://localhost:9080/teamserver
      • 用户: rtsAdmin
      • 密码: rtsAdmin
    4. 单击连接 。 窗口将刷新,底部的区域现已启用。
    5. 确保在“项目配置下的“ 决策中心上创建新项目”处于选中状态。
    6. 点击完成

完成以下步骤,将规则应用程序部署到Rule Execution Server中:

  1. 在左侧的“ 规则浏览器”视图中,展开部署文件夹。
  2. 双击Stocks Demo – deploymentConfiguration部署配置。
  3. 在右侧的“ 部署”部分,点击继续进行Ruleapp部署
  4. 如果打开与Java版本有关的消息,请单击确定
  5. 在“部署摘要”页面上,单击“ 下一步 ”。
  6. 单击凭据部分中的下一步
  7. 点击完成

要测试规则应用程序,请遵循与测试已部署的规则应用程序有关的“ 部署StocksDemoRuleApp”部分中的步骤。

有关更多信息,请参阅IBM Knowledge Center上的以下IBM ODM文档:

安装并配置示例IBMStockRating.twx应用程序

安装规则项目后,可以将“库存申请”流程应用程序( IBMStockRating.twx )导入到IBM BPM Process Center中:

  1. 将流程应用程序导入到IBM BPM中。
    1. 在“流程设计器”中,打开“流程中心”。
    2. 单击Import Process App ,如图3所示。
      图3.导入流程应用
      导入流程应用
    3. 单击浏览搜索并选择已下载的TWX文件。 单击确定 。 您会看到可能会导入其他工具箱,例如BP3 Brazos UI工具箱。
    4. 单击在Designer中打开,然后在Process Designer中打开应用程序。 现在,您已经在Process Designer中打开了Process。
  2. 配置流程应用程序和业务流程以在您的环境中运行。
    1. 在“ Process App设置”中,确保服务器位置正确。 图4中显示的URL是http://localhost:9082 。 这是访问Rule Execution Server控制台的主机和端口。
      图4. Process App Settings服务器选项卡
      处理应用程序设置服务器选项卡
    2. 展开流程,然后双击库存评估批准流程以将其打开。 转到图选项卡以查看业务流程。 如图5所示,此过程包括3条泳道,您可以将其映射到适当的用户。
      图5.库存等级批准流程图
      库存等级批准流程图
    3. 选择Junior Analyst通道并查看行为窗格,如图6所示。
      图6.初级分析师的车道行为
      库存等级批准流程图
    4. 单击Junior Analyst将用户映射到该角色。 在图7的示例中,将Amy添加到IBM BPM环境中。 单击添加用户,然后选择一个用户以将其映射到角色。 (可选)您可以将角色映射到组。
      图7.将用户映射到Junior Analyst角色
      将用户映射到Junior Analyst角色
    5. 请按照相同的步骤将用户或组映射到高级分析师角色。 首先,在业务流程图中选择“ 高级分析师”泳道,然后在“行为”部分中单击“ 高级分析师 ”。 然后将用户或组映射到角色。 在本教程中,Linda是高级分析师。
  3. 在业务流程中配置决策服务。
    1. 查看系统通道。 这是运行评级规则决策服务的运行位置。
    2. 双击“运行规则”服务,它是IBM ODM决策服务。 单击Properties,然后选择Implementation选项卡,如图8所示。
      图8.运行评级规则决策服务
      运行评级规则决策服务
    3. 确保RES服务器的SOAP端口正确。 在该图中,SOAP端口为8882。输入RES Administrator的用户名和密码,然后单击Connect

      如果出现错误,请确保RES服务器的SOAP端口正确。 (导航至WebSphere Application Server管理控制台中的“端口”部分)。 确保用户名和密码正确。

    4. 成功连接后,单击“流程设计器”中的“规则应用程序”字段,然后选择已下载并安装的StocksDemoRuleApp
    5. 选择StocksDemoRuleSet并选择最新版本。 或者,您可以根据需要选择特定版本。 如果规则集版本发生更改并且业务流程需要调用特定版本,则这一点尤其重要。 但是,为简单起见,本教程示例选择最新版本。
    6. 查看Data Mapping选项卡,如图9所示。在本教程中,请不要进行任何更改。 但是,如果需要,您可以将决策ID更改为任何其他字符串。
      图9.数据映射选项卡
      数据映射选项卡

运行库存评估流程示例

股票定价分析的简单过程说明了使用IBM ODM支持决策服务的推荐方法。 该场景特意简单:股票分析师希望根据有关公司绩效的关键信息来确定给定股票的买/卖/持有动作。 该过程涉及给定公司和相关信息的输入,决策服务的执行,以及将响应返回给高级分析师以进行后续操作。 尽管可以进一步详细说明该过程,例如,包括案例管理功能的集成,监视和可视化,对其他文档的请求以及事件通知,但本教程使该过程保持简单,以提供一个切实的示例来支持使用的前提。与将IBM ODM与用JavaScript编码规则或使用IBM BPM嵌入式规则功能相比。

在本部分中,您将运行IBM BPM应用程序,该应用程序将调用决策服务,然后查看结果。 本教程使用BP3中的Brazos UI工具包在人员服务中实现教练。

  1. 确保已完成安装库存复审IBM ODM应用程序安装示例IBMStockRating.twx部分中的步骤。
  2. 打开IBM BPM并启动Process Designer。
  3. 运行IBMStockRating应用程序(以下部分介绍了该应用程序的安装和IBM ODM Rules应用程序)。 选择库存评估批准流程,然后单击按钮以运行此流程。 用Inspector检查该应用程序,如图10所示。
    图10. IBM BPM Inspector中的库存定级批准流程
    IBM BPM Inspector中的库存定级批准流程

    选择收件箱,然后单击绿色按钮以运行处理步骤。

    您也可以通过IBM Process Portal以Amy身份或映射到初级分析师角色的任何其他用户来运行此流程。 如果单击“工作”选项卡,然后单击“ 库存定级批准流程” ,则可以启动该流程,如图11所示。

    图11.运行门户中“我的工作”选项卡中的运行时的库存定级批准流程
    处理门户网站我的工作选项卡

    In either case (running the process through Process Designer or Process Portal), you see the initial Stock Rating Request coach.

  4. Enter IBM in the Ticker field, as shown in Figure 12. The coach is populated with default values. You can modify these values. For the initial test, just accept the defaults and click Submit .
    Figure 12. Enter Stock Rating Request at run time
    Enter Stock Rating Request at                             run time
  5. Click Submit . The human task completes and the business process definition invokes the decision service that is running on IBM ODM with the stock parameter and gets a response back, which is the rating of the stock. The rule conditions are based on growth, earnings per share, price-to-earnings ratio, and the industry.
  6. Run the second human task that receives the results from the decision service in one of the following ways:
    • In Process Designer, refresh the task and run the next step.
    • If you prefer to use the Process Portal like the end users will do, log in as Senior Analyst in Process Portal. In this example, Linda acts in the role of the senior analyst. If you log in with the linda user name with linda as a password, you see a task waiting for you to review. Also note that in the launch section, Linda does not have the ability to launch the stock rating approvals process, because only the junior analyst role has this permission.
  7. As the senior analyst, click Review Ratings Result and scroll down to see the messages and the ratings that are sent by decision service. Click Done to complete this process, and the My Work tab looks like Figure 13.
    Figure 13. My Work tab
    My Work                     tab
  8. Now you can review the underlying decision service implementation from the perspective of the process.
  • In Process Designer, review the Stock Rating Approval Process: in the Analyst lane, double-click the view rating result.
  • Click Set Rating message . The decision service returns a list of messages. The implementation of the Set Rating message contains the code to extract the messages (sent from decision service) from this list, as shown in Figure 14.
    Figure 14. Implementation for Set Rating Message
    Implementation for Set Rating Message

Review the implementation of the Stock Rating decision service in IBM ODM

Now you review the actual implementation of the rules in IBM ODM.

In retrospect, the IBM BPM application could have provided the rating decision. However, you see in the following sections why the introduction of a BRMS provides an optimal approach for implementing the decision services.

At this point, look at the implementation of the decision service and consider why it is preferable to implement this decision service in IBM ODM.

As mentioned in the previous section, the use case is related to a Stocks Rating process. The business rules application receives the stock information, based on some simple business rules that determine performance of stock and rating recommendations (Sell, Hold, or Buy).

The business rules application in this tutorial was implemented in IBM ODM V8.7. The application consists of one Decision Service Main rule project: Stock-rules , with all required artifacts. For the integration, the hosted transparent decision services (HTDS) feature of Decision Server is used to provide a web service, which IBM BPM uses to invoke the rules, as shown in Figure 15.

Figure 15. Execution of operations
Execution concept of operations

The IBM BPM process invokes the execution of the decision service. You pass a S tock as the request and receiving a response of the Stock Response type. When invoking the web service, the process specifies the rule application needed, in this case: StockDemoRuleApp/StocksDemoRuleset .

From the authoring perspective, the business rules artifacts used for this scenario can be summarized in Figure 16.

Figure 16. Business rules artifacts for Stocks Demo
Business rules artifacts for Stocks demo

The rules development lifecycle in Figure 17 illustrates the details of the application.

Figure 17. Rules development lifecycle
Rules development lifecycle

Discovery/analysis/model phase

The analysis and modeling phase is very simple, because you only need to perform a simple stock validation. Rule harvesting includes both rule discovery and analysis. During this phase, business policies or requirements are identified in preparation for the authoring of the business rules.

Modeling of the rule application involves defining the artifacts that you are going to use for the application. This tutorial example, based on the simple scenario, uses a dynamic execution object model (XOM), which is based on a schema definition file. The XOM is imported to create the Business Object Model (BOM). Note that the use of an XSD to create a XOM is often an anti-pattern. Modeling of rules based on a specific application is not a good practice – rule design should normally be done as an independent task, which is detailed in Jerome Boyer and Hafedh Mili's book Agile Business Rule Development: Process, Architecture, and JRules Examples . Figures 18 and 19 show the Stock class and the Stock Response class in the BOM, which was imported from the XSD file.

Figure 18. Members of the Stock class in the BOM
BOM imported from                     the XSD file
Figure 19. Members of the StockResponse class in the BOM
BOM imported from                     the XSD file

Discovery and authoring phase

Authoring rule projects involves the following decisions:

  • Organization of rules: Definition of how the business rules will be put together in a folder organization structure. Organizing rules allows easy access to business artifacts, especially when you have a large volume of rules. Organizing rules also provides a way to classify rules that are common to different scenarios which means that you can reuse them on multiple cases. Some customers organize their rules by business units, regions or product lines. This organization is something that business analysts, in conjunction with subject matter experts decide during the analysis phase. The rule project sample in this tutorial implements two rule packages: rating and validation.
  • Orchestration of rules: During the execution, the rule engine needs to know what set of rules must be evaluated in what order. IBM ODM provides a rule artifact called ruleflow that provides this functionality. Orchestration is very important because it allows you to use a full set of business rules and returns with the result of a complex decision. A ruleflow is one key difference between running rules embedded in IBM BPM and using the business rules approach in IBM ODM.

Figures 20 and 21 present the rule organization and orchestration used in the sample application for this tutorial.

Figure 20. Rule project organization
Rule project organization
Figure 21. Main flow orchestration
Main flow orchestration

IBM ODM provides the following components for authoring:

  1. Rule Designer: An Eclipse-based development environment targeted for IT users to create the rule project framework, including the verbalization and orchestration of the rules and other authoring tasks involved during the rule project development cycle. Diagrams presented in Figures 20 and 21 were extracted from Rule Designer.
  2. Business console and Enterprise console: A set of web interfaces where end users can do all the rule management of the rules, for example: creating, updating and deleting artifacts, taking snapshots, performing deployments, and implementing a governance framework.

The following screen capture examples are from the Business console, which is what end users experience during the rules authoring phase.

The Decision service main rule project was synchronized with Decision Center to continue with the next activities. Figure 22 shows the demo application available in the decision services library.

Figure 22. Decision services library
Decision services library

As previously shown, the rules organization of rules was performed in 2 rule packages, but referred to folders in Decision Center. Figures 23 and 24 present the way rules are visible in the Business console.

Figure 23. Rules organized by folder
Rules organized by folder
Figure 24. Rules organized by name
Rules organized by name

You can go to the Business console on Decision Center to view implemented rules. See Testing and simulating rulesets in the IBM ODM documentation.

Validation phase

For a basic testing of the rules, IBM ODM testing capabilities in the business console allow you to ensure that the rules are working properly. This functionality is not meant to replace formal testing of rules, but it provides rule validation for business users. You can create a testing file with a list of scenarios like the testsuite-v1.xlsx file in sample files for this tutorial. When working with complex decisions, it is very important to test all business rules authored. IBM ODM provides the Decision Validation Services capability for performing these types of tests. To learn more about testing and validating rules, see Testing and simulating rulesets in the IBM ODM documentation.

Deployment phase

The deployment process of the rules in this scenario is performed from Rule Designer and Business console. In preparation for the deployment, a deployment configuration is created. See Deploying from the Business console in the IBM ODM documentation.

Summary of considerations

As previously discussed, there are other ways to implement the decision service. On one hand, you can develop the decision service in code using either JavaScript or Java. A code-based approach is valid for simple if-then-else conditions that are static. However, the stock recommendation example is neither simple nor static. Building this decision service in code would be possible but would lack the adaptability and flexibility needed for the final solution implementation.

The other option is to develop the decision service using the embedded rules functionality in IBM BPM. As you have seen, there are a number of steps in the actual decision service. This means that you need to have multiple decision modes in the actual IBM BPM decision service. This makes the code difficult to manage given the complexity of the rule execution.

So evaluate your approach using the set of criteria previously discussed:

Decision criteria IBM ODM solution approach benefits
Complexity The rules are of a medium complexity. IBM ODM provides a more optimal solution implementation than other alternatives.
Lifecycle management Stock rating is a potentially dynamic decision. By externalizing this in IBM ODM, the underlying rules can be more easily managed as business requirements change without incurring the delays associated with a typical application lifecycle.
Reuse of decision services The rating decision has applicability to potentially other business applications. By externalizing this in IBM ODM, the decisions can be used in a consistent and governed manner across multiple applications.
Business and IT collaboration IT developers are not (in most cases) stock rating subject matter experts. Development of the decisions in IBM ODM provides a more collaborative approach in the design, development, and testing of the solution between business and IT.
Decision services management and visibility By maintaining the rules in an English-like syntax and with intuitive modeling, business users can more easily understand the underlying decision services without the complexity of reviewing code or needing to understand the process application details.

If you look at the other options discussed for implementing the decision services, you can quickly review the appropriateness of the approach for this example.

另类 Solution approach
Implement decision logic in JavaScript in IBM BPM The complexity of the rules result in the creation of multiple lengthy JSAPI routines, which would be hard to manage and limit the reuse of the decision across other applications. Rule changes would require a redeployment of the process application. In addition, the reuse of the component across other applications would be minimal (though implementing in a toolkit would provide some reuse across other IBM BPM applications).
Implement decision logic in the rules editor in IBM BPM This option provides a more intuitive approach for the business users than using JavaScript. However, it requires multiple rule steps, which is not optimal. Rule changes would require a redeployment of the process application. In addition, the reuse of the component across other applications would be minimal (though implementing in a toolkit would provide some reuse across other IBM BPM applications).
Implement decision logic in a Java application and integrate from IBM BPM This option would be moderately difficult to implement. Business user collaboration on the design and modification of the decision would be nearly impossible. At the same time, rule changes would not necessitate a redeployment of the process application. The component could be reused across other applications, but governance and management of the asset would need to use traditional SDLC rigor.
Implement as a decision service in IBM ODM This is definitely the optimal approach, as shown in the Decision criteria table.

结论

This tutorial looked at the key criteria for determining whether to use IBM ODM as part of an IBM BPM solution. You learned the following criteria to consider:

  • Complexity – In most case, decision services of medium or high complexity benefit from an externalized rules approach for example, IBM ODM. IBM ODM provides a number of additional functions for example modeling, simulation which provides organizations a powerful set of capabilities to design and deploy complete decision management solutions – the IBM BPM-based rules approach lacks rigor for anything other than simple rules.
  • Lifecycle management – By enabling independence between the rules and application lifecycles, organization benefit from higher agility and flexibility offered by managing decision services separately from the application development process.
  • Reuse of decision services – Though some reuse is possible for decision services given use of toolkits or code-based decision services (for example Java or web), the built-in governance and management of decision services within IBM ODM provides a more optimal approach given decision services need to be enabled for multiple applications.
  • Business and IT collaboration – Embedding rules in process applications or using externalized code for example Java and Web restricts the access and the ability for business users to be closely involved in the overall rule design, development and management processes.
  • Decision service management and visibility – Lastly, the extended functions of the IBM ODM solution promote a higher level of usability in terms of managing and controlling the decision services for an enterprise which is important for key decision services in use by an enterprise.

Borrowing a line from Forrest Gump, decision management and process management go "together like peas and carrots." Decision Management and Process Management are complimentary to one another, however there are multiple considerations on how to integrate decision services within an application.

致谢

The authors want to acknowledge and thank Jerome Boyer, Stuart Jones and Bertrand Portier for their thoughtful and immensely helpful review of this article – it is great to have their insight and skills in ensuring a quality discussion of these issues.


翻译自: https://www.ibm.com/developerworks/bpm/bpmjournal/1503_simmons/1503_simmons.html

决策树流程

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值