jboss1.7

(文章来宾与北美红帽公司高级解决方案架构师杰伊·保拉杰共同撰写)

几周的提示与技巧文章将深入探讨JBoss BPM Suite,特别是有关如何在两个流程之间进行通信的问题。 在进入解决方案详细信息之前,让我们首先约束将要讨论的用例。

关于两个进程之间的通信方式可能有很多解释,但是我们将从这里开始,以一种简单的方式让一个进程调用另一个进程。 我们还将通过提供的RestAPI展示这种简单的用法,我们将利用该API提供可部署的工件,您可以将其用作任何BPM流程中的自定义工作处理程序。

该工件是一个我们标记为RestApi.java的类,它包含设置和详细信息,使您可以从现有过程中启动另一个过程。

在本文结尾处,我们提供了完整的课程,但首先,我们仔细研究了各个活动部分。

每个类的顶部包括将要使用的各种导入的对象或类,我们对“知识就是一切”(KIE)API组件最感兴趣,您将在其中找到它们以及代表我们的医疗保健示例领域模型的一些对象。

package org.jboss.demo.heathcare;import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;// JBoss BPM Suite API
import org.kie.api.runtime.KieSession;
import org.kie.api.runtime.manager.RuntimeEngine;
import org.kie.api.runtime.process.ProcessInstance;
import org.kie.services.client.api.RemoteRestRuntimeEngineFactory;// Domain model.
import com.redhat.healthcare.CaseContext;
import com.redhat.healthcare.Doctor;
import com.redhat.healthcare.PatientInfo;
import com.redhat.healthcare.Prescription;
import com.redhat.healthcare.Rxdetail;

接下来,我们将找到RestAPI类的实际开始,我们在其中设置使用API​​所需的一些属性以及一个构造函数,以确保我们的JBoss BPM Suite服务器正在运行。 请注意,流程部署ID以及用户名和密码都是虚构的,因此与实际流程数据的任何相似之处都是偶然的。

String deploymentId = "com.redhat.healthcare:patients:1.0";
String bpmUrl = "http://localhost:8080/business-central";
String userId = "admin";
String password = "bpmsuite1!";
URL deploymentUrl;// Constructor to check for availability of BPM server.
//
public RestApi()  {super();try {this.deploymentUrl = new URL();} catch (MalformedURLException e) {e.printStackTrace();}
}

测试的URL假定是基本的默认本地安装,因此,如果您的安装使用其他设置,则需要对此进行调整。

下一个代码片段重点介绍了一种核心帮助程序方法,该方法为我们提供了对运行时引擎的引用。 这是通过RestAPI将我们链接到特定部署com.redhat.healthcare:Patients:1.0的引擎,使我们可以启动该部署中的流程。

// Get a runtime engine based on RestAPI and our deployment.
//
public RuntimeEngine getRuntimeEngine() {RemoteRestRuntimeEngineFactory restSessionFactory = new RemoteRestRuntimeEngineFactory(deploymentId, deploymentUrl, userId, password);// create REST requestRuntimeEngine engine = restSessionFactory.newRuntimeEngine();return engine;
}

使用运行时引擎,我们现在可以访问并创建我们的会话,然后我们就可以在其中启动流程实例。

调用以下方法来启动流程实例,并且仅出于清楚起见,该方法包含创建要提交到我们流程中的数据集合。 您应该很容易看到可以根据需要将其抽象出来,以便将过程变量映射到您的类中。

// Setup our session, fill the data needed for process
// instances and starting our process.
//
public void startProcess() {String taskUserId = userId;// create REST request.RuntimeEngine engine = getRuntimeEngine();KieSession ksession = engine.getKieSession();// setup data for submission to process instance.Doctor doctor = new Doctor();doctor.setAddress("3018 winter");doctor.setCity("madison");doctor.setGender("M");doctor.setGroupId("UW1001");doctor.setHospital("1001");doctor.setName("jey");doctor.setState("WI");PatientInfo pat = new PatientInfo();pat.setAge(12);pat.setName("jey");pat.setSymbtom("Diabetes Insipidus");pat.setType("Diabetes");Rxdetail rxdetail = new Rxdetail();List<rxdetail> details = new ArrayList<rxdetail>();rxdetail.setDrugName("xx");rxdetail.setOther("red");rxdetail.setQty(11);rxdetail.setRxNum(11);details.add(rxdetail);CaseContext cont = new CaseContext();cont.setApprovalReq("N");cont.setApprovalReq("Supervisor");Prescription prescription = new Prescription();prescription.setDoctor(doctor);prescription.setPatientInfo(pat);prescription.setRxdetails(details);// collect all data in our map.Map<string object=""> params = new HashMap<string object="">();params.put("prescription", prescription);params.put("caseContext", cont);// start process.ProcessInstance processInstance = ksession.startProcess("healthcare.patientCaseProcess", params);// verify process started.System.out.println("process id " + processInstance.getProcessId());System.out.println("process id " + processInstance.getId());
}

通过这种方法,我们可以设置流程所需的医生,患者和其他医疗详细信息,将它们收集到地图中,然后将其提交给流程实例以将其全部启动。

现在,我们可以将所有这些联系在一起,以便在调用此方法时运行的主类将设置我们的RestAPI,并在每次调用它时启动一个新的流程实例。

// Start our process by using RestAPI.
//
public static void main(String[] ar) {RestApi api = new RestApi();api.startProcess();
}

我们希望通过本医学示例的简单介绍可以使您了解如何利用提供的JBoss BPM Suite RestAPI来发挥自己的优势。 在这种情况下,我们将其用于与BPM服务器上部署的任何其他进程与特定部署中的特定进程进行通信。

这是RestApi类:

package org.jboss.demo.heathcare;import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;// JBoss BPM Suite API
import org.kie.api.runtime.KieSession;
import org.kie.api.runtime.manager.RuntimeEngine;
import org.kie.api.runtime.process.ProcessInstance;
import org.kie.services.client.api.RemoteRestRuntimeEngineFactory;// Domain model.
import com.redhat.healthcare.CaseContext;
import com.redhat.healthcare.Doctor;
import com.redhat.healthcare.PatientInfo;
import com.redhat.healthcare.Prescription;
import com.redhat.healthcare.Rxdetail;String deploymentId = "com.redhat.healthcare:patients:1.0";
String bpmUrl = "http://localhost:8080/business-central";
String userId = "admin";
String password = "bpmsuite1!";
URL deploymentUrl;// Constructor to check for availability of BPM server.
//
public RestApi()  {super();try {this.deploymentUrl = new URL();} catch (MalformedURLException e) {e.printStackTrace();}
}// Get a runtime engine based on RestAPI and our deployment.
//
public RuntimeEngine getRuntimeEngine() {RemoteRestRuntimeEngineFactory restSessionFactory = new RemoteRestRuntimeEngineFactory(deploymentId, deploymentUrl, userId, password);// create REST requestRuntimeEngine engine = restSessionFactory.newRuntimeEngine();return engine;
}// Setup our session, fill the data needed for process
// instances and starting our process.
//
public void startProcess() {String taskUserId = userId;// create REST request.RuntimeEngine engine = getRuntimeEngine();KieSession ksession = engine.getKieSession();// setup data for submission to process instance.Doctor doctor = new Doctor();doctor.setAddress("3018 winter");doctor.setCity("madison");doctor.setGender("M");doctor.setGroupId("UW1001");doctor.setHospital("1001");doctor.setName("jey");doctor.setState("WI");PatientInfo pat = new PatientInfo();pat.setAge(12);pat.setName("jey");pat.setSymbtom("Diabetes Insipidus");pat.setType("Diabetes");Rxdetail rxdetail = new Rxdetail();List<rxdetail> details = new ArrayList<rxdetail>();rxdetail.setDrugName("xx");rxdetail.setOther("red");rxdetail.setQty(11);rxdetail.setRxNum(11);details.add(rxdetail);CaseContext cont = new CaseContext();cont.setApprovalReq("N");cont.setApprovalReq("Supervisor");Prescription prescription = new Prescription();prescription.setDoctor(doctor);prescription.setPatientInfo(pat);prescription.setRxdetails(details);// collect all data in our map.Map<string object=""> params = new HashMap<string object="">();params.put("prescription", prescription);params.put("caseContext", cont);// start process.ProcessInstance processInstance = ksession.startProcess("healthcare.patientCaseProcess", params);// verify process started.System.out.println("process id " + processInstance.getProcessId());System.out.println("process id " + processInstance.getId());
}// Start our process by using RestAPI.
//
public static void main(String[] ar) {RestApi api = new RestApi();api.startProcess();
}

翻译自: https://www.javacodegeeks.com/2014/12/quick-guide-dissecting-jboss-bpm-cross-process-communication.html

jboss1.7

jboss1.7_快速指南:剖析JBoss BPM跨进程通信相关推荐

  1. jboss默认进程名称_快速指南:剖析JBoss BPM跨进程通信

    jboss默认进程名称 (文章来宾与北美红帽公司高级解决方案架构师杰伊·保拉杰合着) 几周的提示与技巧文章将深入探讨JBoss BPM Suite,特别是有关如何在两个流程之间进行通信的问题. 在深入 ...

  2. 快速指南:剖析JBoss BPM跨进程通信

    (文章来宾与北美红帽公司高级解决方案架构师杰伊·保拉杰共同撰写) 几周的提示与技巧文章将深入探讨JBoss BPM Suite,特别是有关如何在两个流程之间进行通信的问题. 在进入解决方案详细信息之前 ...

  3. 跨进程通信,到底用长连接还是短连接

    一个完整的软件系统大多数情况下是由多个进程共同协作进行的,哪怕它们在同一台服务器上.所以,进程之间如何进行高效的通信至关重要. 单个应用程序+单个数据库这套基础开发套餐我相信每个人都经历过,甚至在初期 ...

  4. Binder跨进程通信原理(一):动态内核加载模块

    先上一张Binder 的工作流程图.(如果不清晰,可以 复制图片链接到浏览器 或 保存到本地 查看,我经常都是这样看图的哈) 一开始上手,陌生的东西比较多,But,其实并不复杂.喔,流程图是用 Pro ...

  5. Chrome源码剖析 上--多线程模型 进程通信 进程模型

    分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow 也欢迎大家转载本篇文章.分享知识,造福人民,实现我们中华民族伟大复兴! Chro ...

  6. 【朝花夕拾】Android跨进程通信总结篇

    前言 原文:https://www.cnblogs.com/andy-songwei/p/10256379.html 只要是面试高级工程师岗位,Android跨进程通信就是最受面试官青睐的知识点之一. ...

  7. 【朝花夕拾】Android性能篇之(七)Android跨进程通信篇

    前言 转载请声明,转自[https://www.cnblogs.com/andy-songwei/p/10256379.html],谢谢! 只要是面试高级工程师岗位,Android跨进程通信就是最受面 ...

  8. 【朝花夕拾】Android性能篇之(七)Android跨进程通信篇...

    前言 原文:https://www.cnblogs.com/andy-songwei/p/10256379.html 只要是面试高级工程师岗位,Android跨进程通信就是最受面试官青睐的知识点之一. ...

  9. Android跨进程通信Binder机制与AIDL实例

    文章目录 进程通信 1.1 进程空间划分 1.2 跨进程通信IPC 1.3 Linux跨进程通信 1.4 Android进程通信 Binder跨进程通信 2.1 Binder简介 2.2 Binder ...

最新文章

  1. 跨域?拒绝说概念(内含demo)
  2. 内存泄露的原因找到了,罪魁祸首居然是 Java TheadLocal
  3. 从CMOS到触发器(一)
  4. adb connect 出现timeout的处理方式
  5. 布道微服务_07服务调用追踪
  6. 手工编程:hello world
  7. python数据库管理软件_MySQL管理工具MySQL Utilities — 介绍与安装(1)
  8. 500 强IT公司武汉诚聘 .Net Specialist (Team Leader)
  9. nodejs操作sqlserver数据_SQL Server数据库损坏和修复
  10. 数据库设计(二)——简单设计实例
  11. 机器人(RPA路程自动化)RPA流程自动化和AI的区别。
  12. 火龙果的全球与中国市场2022-2028年:技术、参与者、趋势、市场规模及占有率研究报告
  13. 如何拉取钉钉的外出、出差审批单
  14. 软件工程师学习硬件原理图--第一讲看懂GPIO和门电路(弱智学前班儿童系列)
  15. Python计算温度植被干旱指数(TVDI)
  16. v-if 和 v-show的区别 vue面试题
  17. 矩阵基础知识------秩+线性相关和线性无关
  18. 苏州新闻网V2.0 新版上线
  19. YouDianCMS建站系统|什么是五站合一?
  20. vasp计算压电系数_无铅四方相钙钛矿短周期超晶格压电效应机理研究

热门文章

  1. Springmvc的静态资源映射配置
  2. javascript 閉包
  3. Java内存溢出详解
  4. iOS8新特性之交互式通知
  5. 在WPF应用程序中利用IEditableObject接口实现可撤销编辑的对象
  6. mysql自动备份脚本,及系统定时备份设置!
  7. 10285 - Longest Run on a Snowboard
  8. Node.js 0.8.21 稳定版发布
  9. Java中Split函数的用法技巧
  10. 如何在Visual Studio中直接使用示例代码浏览器搜索下载和管理代码示例