Flowable 6.6.0 BPMN用户指南-(2)配置 - 2.18.5 ~ 7

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


《Flowable 6.6.0 BPMN用户指南》

2. 配置

有关Flowable文档的其他资料,参见:

《Flowable文档大全》

2.18.5 通过API分发事件

We opened up the event-dispatching mechanism through the API, to allow you to dispatch custom events to any listeners that are registered in the engine. It’s recommended (although not enforced) to only dispatch FlowableEvents with type CUSTOM. Dispatching the event can be done using the RuntimeService:

我们通过API打开事件分派机制,允许您将自定义事件分派给引擎中注册的任何侦听器。建议(尽管不是强制的)只分派类型为CUSTOM的FlowableEvents。可以使用RuntimeService来分派事件:

/**
 * Dispatches the given event to any listeners that are registered.
 * @param event event to dispatch.
 *
 * @throws FlowableException if an exception occurs when dispatching the event or
 * when the {@link FlowableEventDispatcher} is disabled.
 * @throws FlowableIllegalArgumentException when the given event is not suitable for dispatching.
 */
 void dispatchEvent(FlowableEvent event);

2.18.6 支持的事件类型

Listed below are all event types that can occur in the engine. Each type corresponds to an enum value in the org.flowable.engine.common.api.delegate.event.FlowableEventType.

下面列出了引擎中可能发生的所有事件类型。每个类型对应于一个org.flowable.engine.common.api.delegate.event.FlowableEventType中的枚举值。

All ENTITY_* events are related to entities inside the engine. The list below show an overview of what entity-events are dispatched for which entities:
所有ENTITY_*事件都与引擎内的实体相关。下面的列表概述了为哪些实体分派哪些实体事件:

  • ENTITY_CREATED, ENTITY_INITIALIZED, ENTITY_DELETED: Attachment, Comment, Deployment, Execution, Group, IdentityLink, Job, Model, ProcessDefinition, ProcessInstance, Task, User.
  • ENTITY_UPDATED: Attachment, Deployment, Execution, Group, IdentityLink, Job, Model, ProcessDefinition, ProcessInstance, Task, User.
  • ENTITY_SUSPENDED, ENTITY_ACTIVATED: ProcessDefinition, ProcessInstance/Execution, Task.
2.18.7 附加说明

Listeners are only notified for events dispatched from the engine they are registered with. So if you have different engines - running against the same database - only events that originated in the engine the listener is registered to are dispatched to that listener. The events that occur in other engines are not dispatched to the listeners, regardless of whether they are running in the same JVM or not.

Certain event-types (related to entities) expose the targeted entity. Depending on the type or event, these entities cannot be updated anymore (for example, when the entity is deleted). If possible, use the EngineServices exposed by the event to interact in a safe way with the engine. Even then, you need to be cautious with updates/operations on entities that are involved in the dispatched event.

No entity-events are dispatched related to history, as they all have a runtime-counterpart that dispatch their events.

侦听器只会收到从其注册的引擎发送的事件的通知。因此,如果您有不同的引擎(针对同一个数据库运行),那么只有源于侦听器注册的引擎的事件才会被调度到该侦听器。在其他引擎中发生的事件不会被调度到侦听器,不管它们是否在同一个JVM中运行。

向特定的事件类型(与实体相关)暴露目标实体。取决于类型或事件,无法再更新这些实体(例如,当实体被删除时)。如果可能,使用事件暴露的EngineServices以安全的方式与引擎交互。即使如此,您仍然需要谨慎对待与分派事件有关的实体的更新/操作(updates/operations)。

不会分派与历史(history)相关的实体事件,因为它们都有一个运行时的对应方式来分派它们的事件。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

月满闲庭

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值