Flowable 6.6.0 用户指南相关文档下载
- BPMN用户指南 第一部分 - 中文PDF精编版
- BPMN用户指南 第二部分 - 中文PDF精编版
- BPMN用户指南 第三部分 - 中文PDF精编版
- 应用程序指南 - 中文PDF精编版
- 应用程序指南 - 中英对照PDF精编版
- 应用程序指南 - Eclipse设计器中文PDF精编版
- 表单用户指南 - 中文PDF精编版
- 事件注册表用户指南 - 中文PDF精编版
《Flowable 6.6.0 BPMN用户指南》
2. 配置
- 2.1 创建ProcessEngine
- 2.2 ProcessEngineConfiguration Bean
- 2.3 数据库配置
- 2.4 JNDI数据源配置
- 2.5 支持的数据库
- 2.6 创建数据库表
- 2.7 数据库表名说明
- 2.8 数据库升级
- 2.9 作业执行器
- 2.10 作业执行器激活
- 2.11 邮件服务器配置
- 2.12 历史(History)配置
- 2.13 异步历史配置(Async history configuration)
- 2.14 在表达式和脚本中暴露bean
- 2.15 部署缓存配置
- 2.16 日志
- 2.17 映射诊断上下文
- 2.18 事件处理器(Event handlers)
有关Flowable文档的其他资料,参见:
2.18.2 配置和设置(Configuration and setup)
If an event-listener is configured in the process engine configuration, it will be active when the process engine starts and will remain active after subsequent reboots of the engine.
The property eventListeners expects a list of org.flowable.engine.delegate.event.FlowableEventListener instances. As usual, you can either declare an inline bean definition or use a ref to an existing bean instead. The snippet below adds an event-listener to the configuration that is notified when any event is dispatched, regardless of its type:
如果在流程引擎配置中配置了事件侦听器,则它将在流程引擎启动时处于活动(active)状态,并在随后重新启动引擎(subsequent reboots of the engine)后保持活动状态。
属性eventListeners需要一个org.flowable.engine.delegate.event.FlowableEventListener实例的列表(list)。与往常一样,您可以声明内联bean定义,也可以使用对现有bean的引用。下面的代码段向配置中添加了一个事件侦听器,该配置在引发任何事件时都会收到通知,而不考虑其类型:
<bean id="processEngineConfiguration"
class="org.flowable.engine.impl.cfg.StandaloneProcessEngineConfiguration">
...
<property name="eventListeners">
<list>
<bean class="org.flowable.engine.example.MyEventListener" />
</list>
</property>
</bean>
To get notified when certain types of events get dispatched, use the typedEventListeners property, which expects a map. The key of a map-entry is a comma-separated list of event-names (or a single event-name). The value of a map-entry is a list of org.flowable.engine.delegate.event.FlowableEventListener instances. The snippet below adds an event-listener to the configuration, that is notified when a job execution was successful or failed:
要在引发某些类型的事件时获取通知,请使用typedEventListeners属性,该属性需要一个map。map项(map-entry)的key键是以逗号分隔的事件名称列表(或单个事件名称)。map项的值是org.flowable.engine.delegate.event.FlowableEventListener实例。下面的代码段将向配置中添加一个事件侦听器,当作业执行成功或失败时,将通知该侦听器:
<bean id="processEngineConfiguration"
class="org.flowable.engine.impl.cfg.StandaloneProcessEngineConfiguration">
...
<property name="typedEventListeners">
<map>
<entry key="JOB_EXECUTION_SUCCESS,JOB_EXECUTION_FAILURE" >
<list>
<bean class="org.flowable.engine.example.MyJobEventListener" />
</list>
</entry>
</map>
</property>
</bean>
The order of dispatching events is determined by the order in which the listeners were added. First, all normal event-listeners are called (eventListeners property) in the order they are defined in the list. After that, all typed event listeners (typedEventListeners properties) are called, if an event of the right type is dispatched.
事件的引发顺序由侦听器的添加顺序决定。首先,按照列表中定义的顺序调用所有常规事件侦听器(eventListeners属性)。之后,如果引发了某种类型的事件,则调用所有类型化事件侦听器(typedEventListeners属性)。
2.18.3 运行时增加侦听器
It’s possible to add and remove additional event-listeners to the engine by using the API (RuntimeService):
可以使用API(RuntimeService)向引擎添加和删除其他事件侦听器:
/**
* Adds an event-listener which will be notified of ALL events by the dispatcher.
* @param listenerToAdd the listener to add
*/
void addEventListener(FlowableEventListener listenerToAdd);
/**
* Adds an event-listener which will only be notified when an event occurs,
* which type is in the given types.
* @param listenerToAdd the listener to add
* @param types types of events the listener should be notified for
*/
void addEventListener(FlowableEventListener listenerToAdd, FlowableEventType... types);
/**
* Removes the given listener from this dispatcher. The listener will no longer be notified,
* regardless of the type(s) it was registered for in the first place.
* @param listenerToRemove listener to remove
*/
void removeEventListener(FlowableEventListener listenerToRemove);
Please note that the listeners added at runtime are not retained when the engine is rebooted.
请注意,重新启动引擎时不会保留运行时添加的侦听器。