-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
feat: ServiceConfigurator support for various service configurations #3826
feat: ServiceConfigurator support for various service configurations #3826
Conversation
To add more detail to why this is required, taking "VariableServiceConfiguration" as an example, the exact same applies to all the ServiceConfigurations improved with this PR. VariableServiceConfiguration is initialized here https://github.com/flowable/flowable-engine/blob/main/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cfg/ProcessEngineConfigurationImpl.java#L981 which ends up calling https://github.com/flowable/flowable-engine/blob/main/modules/flowable-variable-service/src/main/java/org/flowable/variable/service/VariableServiceConfiguration.java#L78-L82 - after "configuratorsBeforeInit()" , so if one tries to access VariableServiceConfiguration in beforeInit to set the DataManager, it will fail as it has not yet been instantiated. The init() method of VariableServiceConfiguration initialises DataManagers and EntityManagers without any way of setting a custom DataManager before the EntityManager is also initialized. So to be able to initialize the standard VariableServiceConfiguration with the standard VariableInstanceEntityManagerImpl but with a custom DataManager, one needs a way to set DataManager inside VariableServiceConfiguration before the entity manager is initialized - that is accomplished with ServiceConfigurator , exactly as JobServiceConfiguration already does it. I believe this is the cleanest and most maintainable approach to the problem especially because it simply mimics what has already been implemented for JobServiceConfiguration. |
Thanks @ikaakkola. This one makes a lot of sense. It also looks good for merging. I am only contemplating if we can move something to the
Will talk with the team and merge this soon |
I agree the configurator logic is very repetitive, it could probably be generalized in the abstract class. |
@ikaakkola I talked with the team and we think that it would be better if we can move this repetitive bits in the |
@filiphr added generic ServiceConfigurator support for AbstractServiceConfiguration and implemented it in the concrete classes. I also considered moving the before and after init calls to a AbstractServiceConfiguration (so one would not forget to call the configuratorsBefore/AfterInit), something like:
and in concrete ServiceConfiguration class call like:
but this doesn't seem to be a pattern used in the code base, so opted not to introduce it for now. |
2ebd6c1
to
199675f
Compare
That looks interesting. However, we are indeed not using something like that in the codebase. Perhaps at some point down the line. I'll go through your changes now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ikaakkola. Looks good. I've left some comments, some small cleanups before we merge this.
Let me know if you don't agree with something.
...owable-batch-service/src/main/java/org/flowable/batch/service/BatchServiceConfiguration.java
Outdated
Show resolved
Hide resolved
...ngine-common/src/main/java/org/flowable/common/engine/impl/AbstractServiceConfiguration.java
Outdated
Show resolved
Hide resolved
...ble-engine-common/src/test/java/org/flowable/common/engine/impl/ServiceConfiguratorTest.java
Outdated
Show resolved
Hide resolved
...nk-service/src/main/java/org/flowable/entitylink/service/EntityLinkServiceConfiguration.java
Outdated
Show resolved
Hide resolved
.../main/java/org/flowable/eventsubscription/service/EventSubscriptionServiceConfiguration.java
Outdated
Show resolved
Hide resolved
...les/flowable-job-service/src/main/java/org/flowable/job/service/JobServiceConfiguration.java
Show resolved
Hide resolved
.../flowable-task-service/src/main/java/org/flowable/task/service/TaskServiceConfiguration.java
Outdated
Show resolved
Hide resolved
...riable-service/src/main/java/org/flowable/variable/service/VariableServiceConfiguration.java
Outdated
Show resolved
Hide resolved
...riable-service/src/main/java/org/flowable/variable/service/VariableServiceConfiguration.java
Outdated
Show resolved
Hide resolved
...riable-service/src/main/java/org/flowable/variable/service/VariableServiceConfiguration.java
Outdated
Show resolved
Hide resolved
199675f
to
bdb70cf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ikaakkola I've missed one place for the formatting and the JobServiceConfiguration
still has the configurators
field, I think we should remove that as well.
...les/flowable-job-service/src/main/java/org/flowable/job/service/JobServiceConfiguration.java
Outdated
Show resolved
Hide resolved
…tion Added a generic implementation of ServiceConfigurator to AbstractServiceConfiguration and implemented it in the concrete ServiceConfiguration classes. This change allows easier customisation of the individual ServiceConfigurations while they are initialized.
bdb70cf
to
fd1d5a4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all the changes and contribution @ikaakkola. Will merge this once the tests are green
Add support for ServiceConfigurator to Variable, Task, IdentityLink, EntityLink, EventSubscription and Batch ServiceConfiguration to allow customisation at init time.
The implementation follows the logic of JobServiceConfiguration that already has support for ServiceConfigurator.
Check List: