-
Notifications
You must be signed in to change notification settings - Fork 10
快速开始
songhongtu edited this page Jan 17, 2023
·
4 revisions
有一个五个任务串行执行的流程图demo1
下载文件:demo1.bpmn 放到resouces里面
目录结构如下
也可以用 http://123.249.93.130/runflow/ 在线设计自己的流程
目前还没有上传到maven中央仓库,因此需要下载源码 安装到本地仓库
git clone https://github.com/songhongtu/runflow.git
mvn -Dmaven.test.failure.ignore=true clean install
<dependency>
<groupId>com.runflow</groupId>
<artifactId>runflow-core</artifactId>
<version>0.0.1-Beta</version>
</dependency>
ProcessEngineConfigurationImpl conf = new ProcessEngineConfigurationImpl();
RunTimeServiceImpl runTimeService;
{
//初始化
conf.init();
runTimeService = conf.getRunTimeService();
//bpmn位置
conf.addPath("/bpmn/demo1.bpmn");
}
@Test
public void demo1() {
//a.incrementAndGet()
AtomicInteger integer = new AtomicInteger(0);
Map map = new HashMap();
map.put("a", integer);
runTimeService.startWorkflow("Process_1671936597549", map);
System.out.println(integer);
}
直接运行即可
<dependency>
<groupId>com.runflow</groupId>
<artifactId>runflow-spring-boot-starters</artifactId>
<version>0.0.1-Beta</version>
</dependency>
@Autowired
RunTimeServiceImpl runTimeService;
@GetMapping("/demo1")
public Integer demo1(){
AtomicInteger integer = new AtomicInteger(0);
Map map = new HashMap();
map.put("a", integer);
runTimeService.startWorkflow("Process_1671936597549",map);
System.out.println(integer.get());
return integer.get();
}
/**
* 生成图片
* @param key
* @param response
* @throws IOException
*/
@GetMapping("/images")
public void images(String key, HttpServletResponse response) throws IOException {
InputStream inputStream = runTimeService.generaImages(key);
IOUtils.copy(inputStream, response.getOutputStream());
}