Running Multiple definitions against a single set of variables

Perhaps I’m missing something very fundamental here but I’m using flowable with SpringBoot, have a configuration as follows:

 @Bean
    public SpringProcessEngineConfiguration processEngineConfiguration() throws IOException {
        SpringProcessEngineConfiguration springProcessEngineConfiguration = new SpringProcessEngineConfiguration();
        springProcessEngineConfiguration.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
        springProcessEngineConfiguration.setDataSource(dataSource());
        springProcessEngineConfiguration.setTransactionManager(transactionManager());
        springProcessEngineConfiguration.setDeploymentResources(getProcesses());
        return springProcessEngineConfiguration;
    }

getProcesses() loads all bpmn xml process definitions from the resource directory

    private Resource[] getProcesses() throws IOException {
        ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver();
        return resourcePatternResolver.getResources(ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX + "processes/" + "*.*");
    }

I’m able to query the repository service using a ProcessDefinitionQuery and view a list of all the flowableService.getRepositoryService().createProcessDefinitionQuery().list()

I’m working with a large object which is comprised of the inputs of multiple forms combined and can change throughout the application. At various points in the application I want to execute all definitions against this object (the definitions query fields if they are present and trigger service tasks which set response data)

The only way I could seem to think of doing this is by looping through the definitions in the repository and triggering a process instance for each definition currently loaded in the runtime.

Is there a better way?

If you don’t want to code the scheduling you can use timer start events either on your processes that need to reoccur or on a parent process that uses call activity to execute each of your processes.

https://www.flowable.org/docs/userguide/index.html#bpmnTimerStartEvent

Thank you… this actually helps. I was looking at the message start event event
https://www.flowable.org/docs/userguide/index.html#bpmnMessageStartEvent

This sounds like something I want to do, but it says:
The name of the message start event must be unique across all deployed process definitions…

The issue I have with using a timer is I really want this to occur instantaneously as the form object is created/upaded in the system…

Is your overarching workflow running inside of flowable? You could use call activity to start them when it’s appropriate. You could wrap them in a process that calls all of the processes you need to call, so you aren’t cluttering up your processes with hundreds of repeated calls.

You might also get some benefit out using CMMN and placing entry sentries so the processes get kicked off when certain criteria are met.

When you mean overarching workflow you mean the form document? it’s like a collection of multiple forms but really It’s a collection of XML documents wrapped up together, there are a lot of layers in there that would have to get wrapped up…

I’m probably better off the just programatically controlling when the events start and starting them all in a loop… I’ll have to run some load tests to make sure say 500 process engines can be loaded into memory, deployed, load all processes and run them, each instance yielding seperate results in a timely manner

Where can I learn more about CMMN? I see a bit about it in the flowable documenation but not a lot other than the properties to set with Spring…

500 instances of the process engine seems like quite a lot, do you mean 500 processes. Flowable generally scales horizontally, though state is stored in a database so the datasource would need to be configured to scale as well. What kind of throughput are you looking for?

Unfortunately there’s a dearth of tutorials around CMMN, it would be good to get a couple out there soon. Here’s a link to the flowable docs. Essentially, instead of having a linear process the flow is more fluid. Whether or not an item is available is controlled with sentries. An item becomes available as soon as any criteria on one of its entry sentries is satisfied. Items can be grouped into stages, with stages having their own entry and exit sentries. Feel free to message me if you’d like a more in depth discussion.