Flowable 6.6.0 事件注册表用户指南 - 3 Flowable 事件注册表API - 3.5 Web应用中的事件注册表引擎

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

Flowable 6.6.0 事件注册表用户指南

目录

1 事件注册表介绍

2 配置

3 Flowable 事件注册表API

4 Spring集成
5 部署

6 REST API


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

《Flowable文档大全》


3.5 Web应用中的事件注册表引擎

The EventRegistryEngine is a thread-safe class and can easily be shared among multiple threads. In a web application, this means it is possible to create the Event Registry engine once when the container boots and shut down the engine when the container goes down.

EventRegistryEngine是一个线程安全类,可以在多个线程之间轻松共享。在web应用程序中,这意味着可以在容器引导时创建一次事件注册表引擎,并在容器关闭时关闭引擎。

The following code snippet shows how you can write a simple ServletContextListener to initialize and destroy process engines in a plain Servlet environment:

以下代码片段显示了如何编写简单的ServletContextListener,以便在普通的Servlet环境中初始化和销毁流程引擎:

public class EventRegistryEnginesServletContextListener implements ServletContextListener {

  public void contextInitialized(ServletContextEvent servletContextEvent) {
    EventRegistryEngines.init();
  }

  public void contextDestroyed(ServletContextEvent servletContextEvent) {
    EventRegistryEngines.destroy();
  }

}

The contextInitialized method will delegate to EventRegistryEngines.init(). This will look for flowable.eventregistry.cfg.xml resource files on the classpath, and create a EventRegistryEngine for the given configurations (for example, multiple JARs with a configuration file). If you have multiple such resource files on the classpath, make sure they all have different names. When the Event Registry engine is needed, it can be fetched using:

contextInitialized方法将委托给EventRegistryEngines.init(). 这将寻找classpath 上的flowable.eventregistry.cfg.xml资源文件,并为给定的配置创建EventRegistryEngine(例如,具有一个配置文件的多个JAR)。如果classpath上有多个这样的资源文件,请确保它们都有不同的名称。当需要事件注册表引擎时,可以使用以下方法获取它:

EventRegistryEngines.getDefaultEventRegistryEngine()

EventRegistryEngines.getEventRegistryEngine("myName");

Of course, it’s also possible to use any of the variants of creating an Event Registry engine, as described in the configuration section.

The contextDestroyed method of the context-listener delegates to EventRegistryEngines.destroy(). That will properly close all initialized Event Registry engines.

当然,也可以使用创建事件注册表引擎的任何变体,如配置部分所述。

上下文侦听器(context-listener)的contextDestroyed方法委托给EventRegistryEngines.destroy()。这将正确关闭所有已初始化的事件注册表引擎。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

月满闲庭

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

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

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

打赏作者

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

抵扣说明:

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

余额充值