第 59 章 在 Oracle WebLogic Server 中配置嵌入式流程引擎和决策引擎
嵌入式引擎是一个轻量级工作流和规则引擎,使您能够执行您的决策和业务流程。嵌入式引擎可以是 Red Hat Process Automation Manager 应用程序的一部分,或者通过 OpenShift、Kubernetes 和 Docker 部署为服务。您可以通过 API 或一组上下文和依赖项注入(CDI)服务将引擎嵌入到 Red Hat Process Automation Manager 应用程序中。
如果要将嵌入式引擎与红帽流程自动化管理器应用程序一起使用,则必须通过将 Red Hat Business Automation 材料(BOM)文件添加到项目的 pom.xml 文件来添加 Maven 依赖项。Red Hat Business Automation BOM 适用于 Red Hat Decision Manager 和 Red Hat Process Automation Manager。有关 Red Hat Business Automation BOM 的更多信息,请参阅 Red Hat Process Automation Manager 和 Maven 库版本之间的映射是什么?
流程
在
pom.xml文件中声明 Red Hat Business Automation BOM:<dependencyManagement> <dependencies> <dependency> <groupId>com.redhat.ba</groupId> <artifactId>ba-platform-bom</artifactId> <version>7.12.0.redhat-00008</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <dependencies> <!-- Your dependencies --> </dependencies>在 <dependencies> 标签中声明项目
所需的依赖项。将产品 BOM 导入到项目中后,定义了面向用户的产品依赖项的版本,因此您不需要指定这些<dependency>元素的<version>的子元素。但是,您必须使用 <dependency> 元素来声明要在项目中使用的依赖项。对于基本的 Red Hat Process Automation Manager 项目,请根据您要使用的功能声明以下依赖项:
嵌入式进程引擎依赖项
<!-- Public KIE API --> <dependency> <groupId>org.kie</groupId> <artifactId>kie-api</artifactId> </dependency> <!-- Core dependencies for process engine --> <dependency> <groupId>org.jbpm</groupId> <artifactId>jbpm-flow</artifactId> </dependency> <dependency> <groupId>org.jbpm</groupId> <artifactId>jbpm-flow-builder</artifactId> </dependency> <dependency> <groupId>org.jbpm</groupId> <artifactId>jbpm-bpmn2</artifactId> </dependency> <dependency> <groupId>org.jbpm</groupId> <artifactId>jbpm-runtime-manager</artifactId> </dependency> <dependency> <groupId>org.jbpm</groupId> <artifactId>jbpm-persistence-jpa</artifactId> </dependency> <dependency> <groupId>org.jbpm</groupId> <artifactId>jbpm-query-jpa</artifactId> </dependency> <dependency> <groupId>org.jbpm</groupId> <artifactId>jbpm-audit</artifactId> </dependency> <dependency> <groupId>org.jbpm</groupId> <artifactId>jbpm-kie-services</artifactId> </dependency> <!-- Dependency needed for default WorkItemHandler implementations. --> <dependency> <groupId>org.jbpm</groupId> <artifactId>jbpm-workitems-core</artifactId> </dependency> <!-- Logging dependency. You can use any logging framework compatible with slf4j. --> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>${logback.version}</version> </dependency>对于使用 CDI 的 Red Hat Process Automation Manager 项目,您通常声明以下依赖项:
启用 CDI 的进程引擎依赖项
<dependency> <groupId>org.kie</groupId> <artifactId>kie-api</artifactId> </dependency> <dependency> <groupId>org.jbpm</groupId> <artifactId>jbpm-kie-services</artifactId> </dependency> <dependency> <groupId>org.jbpm</groupId> <artifactId>jbpm-services-cdi</artifactId> </dependency>嵌入式决策引擎依赖项
<dependency> <groupId>org.drools</groupId> <artifactId>drools-compiler</artifactId> </dependency> <!-- Dependency for persistence support. --> <dependency> <groupId>org.drools</groupId> <artifactId>drools-persistence-jpa</artifactId> </dependency> <!-- Dependencies for decision tables, templates, and scorecards. For other assets, declare org.drools:business-central-models-* dependencies. --> <dependency> <groupId>org.drools</groupId> <artifactId>drools-decisiontables</artifactId> </dependency> <dependency> <groupId>org.drools</groupId> <artifactId>drools-templates</artifactId> </dependency> <dependency> <groupId>org.drools</groupId> <artifactId>drools-scorecards</artifactId> </dependency> <!-- Dependency for loading KJARs from a Maven repository using KieScanner. --> <dependency> <groupId>org.kie</groupId> <artifactId>kie-ci</artifactId> </dependency>要使用 KIE 服务器,请声明以下依赖项:
客户端应用程序 KIE 服务器依赖项
<dependency> <groupId>org.kie.server</groupId> <artifactId>kie-server-client</artifactId> </dependency>要为 Red Hat Process Automation Manager 创建远程客户端,请声明以下依赖项:
客户端依赖项
<dependency> <groupId>org.uberfire</groupId> <artifactId>uberfire-rest-client</artifactId> </dependency>在创建包含资产(如规则和进程定义)的 JAR 文件时,请将 Maven 项目的打包类型指定为
kjar,并使用org.kie:kie-maven-plugin来处理 <project> 元素下的kjar打包类型。在以下示例中,${kie.version}是 Red Hat Process Automation Manager 和 Maven 库版本之间的映射中列出的 Maven 库版本?<packaging>kjar</packaging> <build> <plugins> <plugin> <groupId>org.kie</groupId> <artifactId>kie-maven-plugin</artifactId> <version>${kie.version}</version> <extensions>true</extensions> </plugin> </plugins> </build>
如果您在项目中使用带有持久性支持的进程引擎或决策引擎,您必须通过从 Red Hat Business Automation BOM 文件复制
version.org.hibernate-4ee7属性,在pom.xml文件的dependencyManagement部分中声明以下 hibernate 依赖项:Hibernate 依赖项
<!-- hibernate dependencies --> <dependencyManagement> <dependencies> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <version>${version.org.hibernate-4ee7}</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>${version.org.hibernate-4ee7}</version> </dependency> </dependencies> </dependencyManagement>