flowable / flowable/flowable-engine

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

Aperta
#3,907 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Java
Stelle
9.5k
Fork
2.9k
Merge medio
7h 8m
PR unite (30g)
2

Descrizione

## 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' ] ],
)
}
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.