flowable / flowable/flowable-engine

Not possible to exclude the `flowable-event-registry` JAR even if EventRegistry disabled

オープン
#3,907 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Java
スター
9.5k
フォーク
2.9k
平均マージ
7時間 8分
マージ済み PR(30日)
2

説明

## Describe the bug

Even when disabling the **EventRegistry** via:
```properties
flowable.eventregistry.enabled = false
```
(see [`@ConditionalOnEventRegistry`](https://github.com/flowable/flowable-engine/blob/90b4b509821d3c0ab0051b2be311afbd158da8db/modules/flowable-spring-boot/flowable-spring-boot-starters/flowable-spring-boot-autoconfigure/src/main/java/org/flowable/spring/boot/condition/ConditionalOnEventRegistry.java) and its usage)

and / or via:
```java
@Bean
EngineConfigurationConfigurer customConfig() {
return spec -> spec.setDisableEventRegistry(true);
}
```
it's still not possible to exclude from dependencies the following JAR:

- `flowable-event-registry`

due to a missing check of whether the **EventRegistry** is disabled in:

https://github.com/flowable/flowable-engine/blob/90b4b509821d3c0ab0051b2be311afbd158da8db/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cfg/ProcessEngineConfigurationImpl.java#L1683

thus not bypassing the instantiation of:

https://github.com/flowable/flowable-engine/blob/90b4b509821d3c0ab0051b2be311afbd158da8db/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cfg/ProcessEngineConfigurationImpl.java#L1688

## Expected behavior

```gherkin
When the "EventRegistry" is "disabled" (via a property or a java code)
Then it's possible to exclude from dependencies the "flowable-event-registry" JAR
```
Most likely via bypassing the instantiation of the [`BpmnEventRegistryEventConsumer`](https://github.com/flowable/flowable-engine/blob/90b4b509821d3c0ab0051b2be311afbd158da8db/modules/flowable-engine/src/main/java/org/flowable/engine/impl/eventregistry/BpmnEventRegistryEventConsumer.java) in such a case.

## Code

Currently, we are forced to apply a dummy work-around, such as:
```java
@Bean
EngineConfigurationConfigurer customConfig() {
return spec -> spec.setDisableEventRegistry(true)
.setEventRegistryEventConsumer(noopEventRegistryEventConsumer());
}

private static EventRegistryEventConsumer noopEventRegistryEventConsumer() {
return new EventRegistryEventConsumer() {
@Override
public EventRegistryProcessingInfo eventReceived(EventRegistryEvent event) {
return null;
}

@Override
public String getConsumerKey() {
return "noopEventConsumer";
}
};
}
```
thus bypassing the instantiation of the [`BpmnEventRegistryEventConsumer`](https://github.com/flowable/flowable-engine/blob/90b4b509821d3c0ab0051b2be311afbd158da8db/modules/flowable-engine/src/main/java/org/flowable/engine/impl/eventregistry/BpmnEventRegistryEventConsumer.java) in:
https://github.com/flowable/flowable-engine/blob/90b4b509821d3c0ab0051b2be311afbd158da8db/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cfg/ProcessEngineConfigurationImpl.java#L1683-L1692

For comparison, the IDM engine's inclusion is properly checked in:
https://github.com/flowable/flowable-engine/blob/90b4b509821d3c0ab0051b2be311afbd158da8db/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cfg/ProcessEngineConfigurationImpl.java#L1676-L1681

## Additional context
**Flowable** branches:
- `flowable-release-7.0.0` (tested v. `7.0.1`)
- `flowable-release-7.1.0`
- `main`

**Spring Boot** used in the version declared by the respective **Flowable** version.

relevant exclusions & dependencies in `build.gradle`:
```gradle
configurations.all {
excludeRules += [
[ group: 'org.flowable', module: 'flowable-cmmn-model' ],
[ group: 'org.flowable', module: 'flowable-dmn-model' ],
[ group: 'org.flowable', module: 'flowable-event-registry' ],
[ group: 'org.flowable', module: 'flowable-event-registry-configurator' ],
[ group: 'org.flowable', module: 'flowable-event-registry-model' ],
[ group: 'org.flowable', module: 'flowable-idm-engine' ],
[ group: 'org.flowable', module: 'flowable-idm-engine-configurator' ],
[ group: 'org.yaml', module: 'snakeyaml' ],
]
}

dependencies {
implementation (
[ group: 'org.flowable', name: 'flowable-http' ],
[ group: 'org.flowable', name: 'flowable-secure-javascript' ],
[ group: 'org.flowable', name: 'flowable-spring-boot-starter-process',
exclude: [ group: 'org.flowable', module: 'flowable-event-registry-spring-configurator' ] ],
)
}
```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

modules/flowable-engine/src/main/java/org/flowable/engine/impl/cfg/ProcessEngineConfigurationImpl.java の1676-1692行付近から始め、その後 ConditionalOnEventRegistry と BpmnEventRegistryEventConsumer を読んでください。EventRegistry のパスを IDM の包含チェックと比較してください。プロパティまたは設定で EventRegistry を無効にしたときに consumer がインスタンス化されなくなり、flowable-event-registry を除外できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java, spring-boot
領域
backend
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
55/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。