热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Flowable6.6.0BPMN用户指南17高级用例17.1异步执行器(1)

Flowable6.6.0用户指南相关文档下载BPMN用户指南第一部分-中文PDF精编版BPMN用户指南第二部分-中文PDF精编版BPMN用户指南第三部分-中文PDF精编版应用程

Flowable 6.6.0 用户指南相关文档下载


  • BPMN用户指南 第一部分 - 中文PDF精编版
  • BPMN用户指南 第二部分 - 中文PDF精编版
  • BPMN用户指南 第三部分 - 中文PDF精编版
  • 应用程序指南 - 中文PDF精编版
  • 应用程序指南 - 中英对照PDF精编版
  • 应用程序指南 - Eclipse设计器中文PDF精编版
  • 表单用户指南 - 中文PDF精编版
  • 事件注册表用户指南 - 中文PDF精编版



《Flowable 6.6.0 BPMN用户指南》
1. 入门

2. 配置

3 The Flowable API

4 Flowable 6.6.0 BPMN用户指南 - (4)Spring集成

5 Spring Boot

6 部署

7 BPMN 2.0简介

8 BPMN 2.0的构造

9 表单(Forms)

10 流程实例迁移

11 JPA

12 历史(History)

13 身份管理(Identity management)

14 REST API

15 CDI集成

16 LDAP集成

17 高级用例

  • 17.1 异步执行器(Async Executor)
    • 17.1.1 异步执行器设计(Async Executor design)
    • 17.1.2 异步执行器配置
    • 17.1.3 基于异步执行器的消息队列
  • 17.2 与流程解析挂钩(Hooking into process parsing)
  • 17.3 用于高并发的UUID ID生成器
  • 17.4 多租户(Multitenancy)
  • 17.5 执行自定义SQL(Execute custom SQL)
  • 17.6 采用ProcessEngineConfigurator 进行高级的流程引擎配置
  • 17.7 高级查询API:运行时和历史任务查询之间的无缝切换
  • 17.8 重写标准SessionFactory实现自定义身份管理
  • 17.9 启用安全的BPMN 2.0 xml
  • 17.10 事件日志记录(Event logging)
  • 17.11 禁用批量插入(Disabling bulk inserts)
  • 17.12 安全脚本(Secure Scripting)
  • 17.13 日志记录会话[实验性]



有关Flowable的更多文档,参见:

《Flowable文档大全》



17 高级用例

The following sections cover advanced use cases of Flowable, that go beyond typical execution of BPMN 2.0 processes. As such, a certain proficiency and experience with Flowable is advised to understand the topics described here.

下面几节介绍了Flowable的高级用例,这些用例超出了BPMN 2.0流程的典型执行。因此,建议您对Flowable有一定的熟练程度和经验,以了解此处所述的主题。

17.1 异步执行器(Async Executor)

In Flowable v5, the Async executor was added in addition to the existing job executor. The Async Executor has proved to be more performant than the old job executor by many users of Flowable and in our benchmarks.

在Flowable V5中,除了现有的作业执行器之外,还添加了异步执行器(Async executor)。许多Flowable用户和我们的基准测试已经证明,异步执行器比旧的作业执行器性能更好。

From Flowable V6, the async executor is the only one available. For V6, the async executor has been completely refactored for optimal performance and pluggability, while still being compatible with existing APIs.

在Flowable V6中,异步执行器是唯一可用的。对于V6,异步执行器已经完全重构以获得最佳性能和可插性(performance and pluggability),同时仍然与现有API兼容。

17.1.1 异步执行器设计(Async Executor design)

Two types of jobs exist: timers (such as those belonging to a boundary event on a user task) and async continuations (belonging to a service task with the flowable:async=“true” attribute).

Timers are the easiest to explain: they are persisted in the ACT_RU_TIMER_JOB table with a certain due date. There is a thread in the async executor that periodically checks if there are new timers that should fire (in other words, the due date is ‘before’ the current time). When that happens, the timer is removed and an async job is created.

存在两种类型的作业:定时器(例如属于用户任务上边界事件的定时器)和异步持续(属于具有flowable:async=“true” 属性的服务任务)。

定时器是最容易解释的:它们被保存在具有特定截止日期的ACT_RU_TIMER_JOB表中。异步执行器中有一个线程,它定期检查是否有新的定时器应该触发(换句话说,截止日期是当前时间的“之前”)。当发生这种情况时,将删除定时器并创建一个异步作业。

An async job is inserted in the database during the execution of process instance steps (which means, during some API call that was made). If the async executor is active for the current Flowable engine, the async job is actually already locked. This means that the job entry is inserted in the ACT_RU_JOB table and will have a lock owner and a lock expiration time set. A transaction listener that fires on a successful commit of the API call triggers the async executor of the same engine to execute the job (so the data is guaranteed to be in the database). To do this, the async executor has a configurable thread pool from which a thread will execute the job and continue the process asynchronously. If the Flowable engine does not have the async executor enabled, the async job is inserted in the ACT_RU_JOB table without being locked.

在执行流程实例步骤的过程中(也就是说,在进行的某个API调用期间),将在数据库中插入异步作业。如果对当前Flowable引擎,异步执行器处于活动状态,则异步作业实际上已被锁定。这意味着作业条目被插入到ACT_RU_JOB表中,并将设置一个锁所有者(lock owner )和一个锁到期时间(lock expiration time )。在成功提交API调用时激发的事务侦听器(transaction listener)会触发同一引擎的异步执行器(async executor)来执行作这个业(因此保证数据在数据库中)。为此,异步执行器有一个可配置的线程池,线程将从中执行作业并异步继续流程。如果Flowable引擎未启用异步执行器,则异步作业将插入ACT_RU_JOB表中,而不会被锁定。

Similar to the thread that checks for new timers, the async executor has a thread that ‘acquires’ new async jobs. These are jobs that are present in the table that are not locked. This thread will lock these jobs for the current Flowable engine and pass it to the async executor.

与检查新定时器的线程类似,异步执行器(async executor)有一个“获取”新异步作业(async job)的线程。这些作业是表中未锁定的作业。此线程将为当前Flowable引擎锁定这些作业,并将其传递给异步执行器。

The thread pool executing the jobs uses an in-memory queue from which to take jobs. When this queue is full (this is configurable), the job will be unlocked and re-inserted into its table. This way, other async executors can pick it up instead.

执行作业的线程池使用内存中的队列从中获取作业。当此队列已满(这是可配置的)时,作业将被解锁并重新插入其表中。这样,其他异步执行器就可以取而代之。

If an exception happens during job execution, the async job will be transformed to a timer job with a due date. Later, it will be picked up like a regular timer job and become an async job again, to be retried soon. When a job has been retried for a (configurable) number of times and continues to fail, the job is assumed to be ‘dead’ and moved to the ACT_RU_DEADLETTER_JOB. The ‘deadletter’ concept is widely used in various other systems. An administrator will now need to inspect the exception for the failed job and decide what the best course of action is.

如果在作业执行期间发生异常,则异步作业将转换为具有到期日期的定时器作业。稍后,它将像常规定时器作业一样被拾取,并再次成为异步作业,稍后将重试。当某个作业已重试(可配置)多次并继续失败时,该作业被假定为“已停止”并移动到ACT_RU_DEADLETTER_JOB。“死信”概念广泛应用于其他各种系统。管理员现在需要检查失败作业的异常,并确定最佳操作方案。

Process definitions and process instances can be suspended. Suspended jobs related to these definitions or instances are put in the ACT_RU_SUSPENDED_JOB table, to make sure the query to acquire jobs has as few possible conditions in its where clause.

可以挂起流程定义和流程实例。与这些定义或实例相关的挂起作业放在ACT_RU_SUSPENDED_JOB表中,以确保获取作业的查询在其where子句中有尽可能少的条件。

One thing that is clear from the above: for people familiar with the old implementations of the job/async executor, the main goal is to allow the ‘acquire queries’ to be as simple as possible. In the past (before V6), one table was used for all job types/states, which made the ‘where’ condition large as it catered for all the use cases. This problem is now solved and our benchmarks have proved that this new design delivers better performance and is more scalable.

上面有一点很清楚:对于熟悉作业/异步执行器的旧实现的人来说,主要目标是让“获取查询”尽可能简单。在过去(在V6之前),一个表用于所有作业类型/状态,这使得“where”条件很大,因为它适合所有用例。这个问题现在解决了,我们的基准测试已经证明,这种新的设计提供了更好的性能和更高的可扩展性。



培训视频推荐

CSDN上提供了Flowable 6.6.0的系列培训视频课程,欢迎有兴趣的朋友前往学习。

  • 《Flowable流程入门课程》
  • 《Flowable流程高级课程》
  • 《Flowable从入门到精通》

推荐阅读
  • t-io 2.0.0发布-法网天眼第一版的回顾和更新说明
    本文回顾了t-io 1.x版本的工程结构和性能数据,并介绍了t-io在码云上的成绩和用户反馈。同时,还提到了@openSeLi同学发布的t-io 30W长连接并发压力测试报告。最后,详细介绍了t-io 2.0.0版本的更新内容,包括更简洁的使用方式和内置的httpsession功能。 ... [详细]
  • 本文介绍了如何使用PHP向系统日历中添加事件的方法,通过使用PHP技术可以实现自动添加事件的功能,从而实现全局通知系统和迅速记录工具的自动化。同时还提到了系统exchange自带的日历具有同步感的特点,以及使用web技术实现自动添加事件的优势。 ... [详细]
  • Java序列化对象传给PHP的方法及原理解析
    本文介绍了Java序列化对象传给PHP的方法及原理,包括Java对象传递的方式、序列化的方式、PHP中的序列化用法介绍、Java是否能反序列化PHP的数据、Java序列化的原理以及解决Java序列化中的问题。同时还解释了序列化的概念和作用,以及代码执行序列化所需要的权限。最后指出,序列化会将对象实例的所有字段都进行序列化,使得数据能够被表示为实例的序列化数据,但只有能够解释该格式的代码才能够确定数据的内容。 ... [详细]
  • Android中高级面试必知必会,积累总结
    本文介绍了Android中高级面试的必知必会内容,并总结了相关经验。文章指出,如今的Android市场对开发人员的要求更高,需要更专业的人才。同时,文章还给出了针对Android岗位的职责和要求,并提供了简历突出的建议。 ... [详细]
  • 本文介绍了如何使用php限制数据库插入的条数并显示每次插入数据库之间的数据数目,以及避免重复提交的方法。同时还介绍了如何限制某一个数据库用户的并发连接数,以及设置数据库的连接数和连接超时时间的方法。最后提供了一些关于浏览器在线用户数和数据库连接数量比例的参考值。 ... [详细]
  • eclipse学习(第三章:ssh中的Hibernate)——11.Hibernate的缓存(2级缓存,get和load)
    本文介绍了eclipse学习中的第三章内容,主要讲解了ssh中的Hibernate的缓存,包括2级缓存和get方法、load方法的区别。文章还涉及了项目实践和相关知识点的讲解。 ... [详细]
  • 图解redis的持久化存储机制RDB和AOF的原理和优缺点
    本文通过图解的方式介绍了redis的持久化存储机制RDB和AOF的原理和优缺点。RDB是将redis内存中的数据保存为快照文件,恢复速度较快但不支持拉链式快照。AOF是将操作日志保存到磁盘,实时存储数据但恢复速度较慢。文章详细分析了两种机制的优缺点,帮助读者更好地理解redis的持久化存储策略。 ... [详细]
  • MyBatis错题分析解析及注意事项
    本文对MyBatis的错题进行了分析和解析,同时介绍了使用MyBatis时需要注意的一些事项,如resultMap的使用、SqlSession和SqlSessionFactory的获取方式、动态SQL中的else元素和when元素的使用、resource属性和url属性的配置方式、typeAliases的使用方法等。同时还指出了在属性名与查询字段名不一致时需要使用resultMap进行结果映射,而不能使用resultType。 ... [详细]
  • 本文介绍了Web学习历程记录中关于Tomcat的基本概念和配置。首先解释了Web静态Web资源和动态Web资源的概念,以及C/S架构和B/S架构的区别。然后介绍了常见的Web服务器,包括Weblogic、WebSphere和Tomcat。接着详细讲解了Tomcat的虚拟主机、web应用和虚拟路径映射的概念和配置过程。最后简要介绍了http协议的作用。本文内容详实,适合初学者了解Tomcat的基础知识。 ... [详细]
  • Tomcat/Jetty为何选择扩展线程池而不是使用JDK原生线程池?
    本文探讨了Tomcat和Jetty选择扩展线程池而不是使用JDK原生线程池的原因。通过比较IO密集型任务和CPU密集型任务的特点,解释了为何Tomcat和Jetty需要扩展线程池来提高并发度和任务处理速度。同时,介绍了JDK原生线程池的工作流程。 ... [详细]
  • 本文详细介绍了Spring的JdbcTemplate的使用方法,包括执行存储过程、存储函数的call()方法,执行任何SQL语句的execute()方法,单个更新和批量更新的update()和batchUpdate()方法,以及单查和列表查询的query()和queryForXXX()方法。提供了经过测试的API供使用。 ... [详细]
  • 有没有一种方法可以在不继承UIAlertController的子类或不涉及UIAlertActions的情况下 ... [详细]
  • 如何在服务器主机上实现文件共享的方法和工具
    本文介绍了在服务器主机上实现文件共享的方法和工具,包括Linux主机和Windows主机的文件传输方式,Web运维和FTP/SFTP客户端运维两种方式,以及使用WinSCP工具将文件上传至Linux云服务器的操作方法。此外,还介绍了在迁移过程中需要安装迁移Agent并输入目的端服务器所在华为云的AK/SK,以及主机迁移服务会收集的源端服务器信息。 ... [详细]
  • 单点登录原理及实现方案详解
    本文详细介绍了单点登录的原理及实现方案,其中包括共享Session的方式,以及基于Redis的Session共享方案。同时,还分享了作者在应用环境中所遇到的问题和经验,希望对读者有所帮助。 ... [详细]
  • web.py开发web 第八章 Formalchemy 服务端验证方法
    本文介绍了在web.py开发中使用Formalchemy进行服务端表单数据验证的方法。以User表单为例,详细说明了对各字段的验证要求,包括必填、长度限制、唯一性等。同时介绍了如何自定义验证方法来实现验证唯一性和两个密码是否相等的功能。该文提供了相关代码示例。 ... [详细]
author-avatar
手机用户2502853447_666
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有