Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
karel-cernohorsky opened this issue Jun 10, 2024 · 0 comments

Comments

@karel-cernohorsky
Copy link

karel-cernohorsky commented Jun 10, 2024

Describe the bug

Even when disabling the EventRegistry via:

flowable.eventregistry.enabled = false

(see @ConditionalOnEventRegistry and its usage)

and / or via:

@Bean
EngineConfigurationConfigurer<SpringProcessEngineConfiguration> 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:

thus not bypassing the instantiation of:

bpmnEventRegistryEventConsumer = new BpmnEventRegistryEventConsumer(this);

Expected behavior

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 in such a case.

Code

Currently, we are forced to apply a dummy work-around, such as:

@Bean
EngineConfigurationConfigurer<SpringProcessEngineConfiguration> 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 in:

public void afterInitEventRegistryEventBusConsumer() {
EventRegistryEventConsumer bpmnEventRegistryEventConsumer = null;
if (eventRegistryEventConsumer != null) {
bpmnEventRegistryEventConsumer = eventRegistryEventConsumer;
} else {
bpmnEventRegistryEventConsumer = new BpmnEventRegistryEventConsumer(this);
}
addEventRegistryEventConsumer(bpmnEventRegistryEventConsumer.getConsumerKey(), bpmnEventRegistryEventConsumer);
}

For comparison, the IDM engine's inclusion is properly checked in:

public void afterInitTaskServiceConfiguration() {
if (engineConfigurations.containsKey(EngineConfigurationConstants.KEY_IDM_ENGINE_CONFIG)) {
IdmEngineConfigurationApi idmEngineConfiguration = (IdmEngineConfigurationApi) engineConfigurations.get(EngineConfigurationConstants.KEY_IDM_ENGINE_CONFIG);
this.taskServiceConfiguration.setIdmIdentityService(idmEngineConfiguration.getIdmIdentityService());
}
}

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:

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' ] ],
    )
}
@karel-cernohorsky karel-cernohorsky changed the title Not possible to exclude the flowable-event-registry JAR even if EventRegistry disabled Not possible to exclude the flowable-event-registry JAR even if EventRegistry disabled Jun 10, 2024
@karel-cernohorsky karel-cernohorsky changed the title Not possible to exclude the flowable-event-registry JAR even if EventRegistry disabled Not possible to exclude the flowable-event-registry JAR even if **EventRegistry** disabled Jun 10, 2024
@karel-cernohorsky karel-cernohorsky changed the title Not possible to exclude the flowable-event-registry JAR even if **EventRegistry** disabled Not possible to exclude the flowable-event-registry JAR even if EventRegistry disabled Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant