flowable / flowable/flowable-engine

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

Đang mở
#3,907 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Java
Star
9.5k
Fork
2.9k
Merge trung bình
7 giờ 8 phút
Pull request đã merge (30 ngày)
2

Mô tả

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

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Bắt đầu tại modules/flowable-engine/src/main/java/org/flowable/engine/impl/cfg/ProcessEngineConfigurationImpl.java, khoảng các dòng 1676-1692, sau đó đọc ConditionalOnEventRegistry và BpmnEventRegistryEventConsumer. So sánh đường đi của EventRegistry với kiểm tra bao gồm IDM. Hoàn thành khi việc vô hiệu hóa EventRegistry bằng property hoặc cấu hình không còn khởi tạo consumer, cho phép loại trừ flowable-event-registry.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
java, spring-boot
Lĩnh vực
backend
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
55/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.