Configure multiple process engines in one springboot app


#1

Can we setup multiple process engines in one springboot app?


#2

Why would you want to?


#3

@Niall we have multiple tenants, so if I was able to configure multiple process engines, each process engines can serve different tenants. Also in scaling perspective I can bring one more ec2 instance with multiple process engines. We have separate schema for every tenants

Will camunda support configuration of multiple process engines in one spring boot application?


#4

So, the reason i ask is because it might not be a good idea to have multiple engines for the reasons you’re asking about.

It’s much better to create tenant markers instead of and engine-per-tenant
It’s MUCH easier to scale if you have one engine per spring boot application, then you can just start as many spring boot applications as you need to scale.


#5

@Niall you mean discriminator column for specifying the tenants ?

In our case, we don’t want to use discriminator column. Every tenants wants to store the data in different schema.

If I don’t want to use the discriminator column means, then only option is to setup one spring boot application with only one process engine.

For each tenant again i have to run one more spring boot app(one process engine) right?

Also, similar post found in stackoverflow and google forums discussed by @jangalinski and @thorben

In addition to that details if possible provide your inputs, how can i achieve above mentioned requirements?


#6

The reason i would advice against having engine-per tenant is because it makes maintenance much harder.

If you wanted to add a new tenant you would need to go into your springboot project add additional engine via config then you’d need to go and add a new schema to your datasource, then you’d need to bring down the current cluster and rebuild it with a new cluster that contains a new tenant.

While it’s up and running it should work but as soon as you need to make any changes it’s going to require a lot of effort. Just so you know what you’re getting in for.


#7

Yeah I understand the problems, but one more thing I was interested from the above statement i understood that its possible to configure multiple process engines in one process application(one spring boot app) itself.

Is my understanding right, correct if I’m wrong?


#8

Yup, shouldn’t be a problem, although I’ve never tried it myself with spring boot.


#9

@aravindhrs take a look at the following thread that discusses the usage of multiple engines in a single springboot app, you had already asked a similar question:


#10

@Niall I came through the camunda docs, where it mentioned like, its possible to configure more than one process engine in one process application.


#11

I hope if this is possible to configure multiple engine is process.xml, then same can be achieved through spring java config too.

<process-application
xmlns="http://www.camunda.org/schema/1.0/ProcessApplication"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <process-engine name="tenant1">
    <configuration>org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration</configuration>
  </process-engine>
  
  <process-engine name="tenant2">
    <configuration>org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration</configuration>
  </process-engine>

  <process-archive name="loan-approval-tenant1">
    <process-engine>tenant1</process-engine>
    <properties>
      <property name="isDeleteUponUndeploy">false</property>
      <property name="isScanForProcessDefinitions">true</property>
    </properties>
  </process-archive>
  
  <process-archive name="loan-approval-tenant2">
    <process-engine>tenant2</process-engine>
    <properties>
      <property name="isDeleteUponUndeploy">false</property>
      <property name="isScanForProcessDefinitions">true</property>
    </properties>
  </process-archive>

</process-application>

Also this link