Configure multiple process engines in one springboot app

Can we setup multiple process engines in one springboot app?

Why would you want to?

@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?

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.

1 Like

@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?

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.

1 Like

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?

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

1 Like

@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:

1 Like

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

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

@aravindhrs / @StephenOTT

Do you have any concluding statement for “Multi tenancy per tenant per schema level in Camunda Springboot Starter Project”.

Because as per configuration available here: https://docs.camunda.org/manual/7.11/user-guide/spring-boot-integration/configuration/ I don’t see where I can create multiple DataSource for each tenant.

Although, process.xml gives option to point to different DataSource for each processEngine. But those Should be present in SpringBoot Context. Which I don’t see to happen through configuration.

Or Sping’s “configure more than one datasource” concept will come into picture.
I am quite unclear on this. Can you guys please help if above problem statement is really possible to implement. Also it will be great to point to exact configuration to use if possible.

@gomzee refer the below post:

@aravindhrs
thanks for the reply. So, final conclusion is we can’t do it.

In order to setup multiple process engines, better to use container(Tomcat/Wildfly) managed distributions of camunda.

This way we have already implemented. We wanted to check the scope using Sprinboot Starter so that we can deploy on cloud and have deployment/scaling etc… easily.

@gomzee, Deploying springboot/docker application per tenant is always scalable model in cloud/non-cloud environments. Only limitation is when number of tenants is huge, then you will endup in deploying large number of spring boot applications.

Yes agreeing to it. That’s why I was exploring the aspect of having tenants per schema basis in single Spingboot application. Because using Wildlfly/Jboss/tomcat for schema level tenancy is not plain in deployment terms and overall sc
alability.
Nevertheless, we have the answer for the problem statement.

Multiple engines in a single springboot app was never built from my understanding in previous threads. Scaling is done with multiple apps each with their own single engine instance. All connected to same dB