I’ve deployed an application in CF with bpmn. Now I’m adding/reducing the number of instances of the application based on the load on it, but the issue is, with new application instance, there is a new flowable-engine getting created. So the process instance which was created by engine1 is not recognized by engine2.
But according to my scenario, I need only one flowable-engine for any number of application instances. Is it possible somehow, following are the ways which I can think of,
One separate application with flowable bpmn which can be consumed by other applications instances
any configuration which can limit the flowable-engine to 1 regardless of how many instances of an application I have (if there is something available like this)
Multiple instances of the engines pointing at the same data source should have a shared knowledge of process instances. Are you using different datasources for flowable in each instance of your microservice?
If you don’t need the engine to scale along with other aspects of the microservices, you can separate them and use the REST interface to interact with the engine. I would still recommend having at least two instances for high availability.
I don’t think this is possible, the standard way to do that with microservices is to separate logic that does not need to scale at the same time into different services.
I’m using the same datasource and in this case, according to you all the flowable-engines should point to a shared knowledge to get the information about process instance.
In my scenario,
I’ve one call to create the process instance
The second call starts that process instance by id and proceed
But I found that another instance of the application(where the new instance of flowable-engine also got created) was unable to recognize the process instance id, even though the datasource is same. This is the way => https://www.flowable.org/docs/userguide/index.html#springSpringBoot I’ve used to create the process engine(using beans).
There’s a misconfiguration that is causing you to believe they are pointed at the same database but you aren’t actually
The process has either not hit a wait state so that the database transaction can finish or the process has already finished (possibly due to an error).
Some questions:
What database are you using? In memory databases like H2 are not shared between instances and cane cause behavior like this.
If you just used the starter did you perform any custom configuration or initialization of the process engine? If so, can you share it?
I’m assuming that you are you’re binding the database service and allowing the app to pick up the auto-configured credentials. I know I’ve had some trouble getting the app to pick up the connection information. Can you verify you have the correct spring cloud dependencies?
spring-cloud-spring-service-connector may not be strictly required it looks like its dependencies are in spring-cloud-cloudfoundry-connector. They are the method that the bound VCAP_SERVICES provided to the app by CF get turned into datasources. My theory is this:
Looking for a process by process id is simply a call to the database
If one instance of the service can see the process but the other cannot, they must not be looking at the same database
I have personally had issues getting Spring Boot applications detecting and using CF’s bound datasources if I did not use the correct dependencies.
In that case should look the datasource which is getting created, whether it’s the same or not?
Few questions which I have:
But is it possible that while creating multiple instances of an application, new datasource would be created which is then used for the creation of flowable engine?
Are the configurations right for flowable engine, is there any chance the configurations which I’ve made can cause any issues later?
SCHEMA_NAME is just a final string where datasource name is defined. And, casPostgresDbProvider is an autowired object of class where SCHEMA_NAME is defined.