flowable-engine
flowable-engine copied to clipboard
Spring Boot integration dependency issues
Describe the bug I'm focusing on the BPMN process engine since that's what I'm most familiar with. There are multiple conceptual problems with the Spring Boot integration that every user of the integration would sooner or later hit:
- Even though you've taken care of starting the async executor later so that all beans (mainly
JavaDelegate
s andFlowableEventListener
s) are already loaded, this is still a problem for direct usages ofRuntimeService#startProcessInstance*
during startup. The reason is the same - there's an implicit requirement that all beans are loaded before using a given process definition. - The same consideration mentioned above has to be applied on shutdown. Otherwise, a given
JavaDelegate
bean can be destroyed before the async executor is shut down and the process instances may fail due to the absence of the bean in the application context.
Expected behavior The above problems and necessary considerations should be clear to anyone trying to use the integration as well as having proper and flexible solutions to the problems (especially the second one).
Additional context Flowable version: 7.0.0.M1, Spring Boot integration. Database: Postgres 14.
Hi, not sure what you are expecting from a Flowable project point of view. You are correct that RuntimeService will require the Spring Boot application to have started up, but you can easily define that your custom logic should be executed after Spring Boot has been started. For your second point this might be true in very specific cases, but what would be your suggestion to improve this?
For the first one - as I said, at least it should be documented or people will end up having to read all the work you've done to understand what's the problem.
For the second one - you can stop the job executor earlier. You're missing the implementation of stop
that corresponds to the start
in SpringProcessEngineConfiguration
. Note that this won't work out of the box with the current implementation of SpringAsyncTaskExecutor#shutdown
that will not shut down immediately. The DefaultAsyncTaskExecutor
would do the job (still depending on the flag executorNeedsShutdown
).
BTW I was surprised that there's no corresponding method to stop the executors in ProcessEngine
.
P.S. I would add that the second issue is not "for very specific cases". As long as you have running process instances during the shutdown, it is likely to occur and those instances would need a manual trigger.