Java Spring Boot Camunda + Microservice Architecture

Hello all,

I’m currently have a Spring Boot micro-service application and I would like to start integrating Camunda’s process engine into one of the services (this service is currently hosting a subset of my application’s APIs). I would also like to utilize Camunda’s web apps to view and monitor my deployed processes.

I’m currently not quite sure what is the best approach in implementing Camunda’s process engine. I understand I can run the Camunda embedded process engine, but I wanted to think about future implementations where I might need Camunda’s process engine in my other services as well.

If I do intend to use Camunda’s process engine in multiple services, should I use a shared process engine? I also would like to use the Java APIs to interact between my services and the process engine if that case is possible.

Let me know what your experiences with Camunda and Spring Boot integration are as I’m just starting out using Camunda.

2 Likes

No. You just pull in the camunda library as a dependency into your project – and you’re done. Then your custom code can interact with camunda using its Java API. Camunda is just another library.

I’d install the cockpit (the GUI) as a separate application. Just configure it so that it works with the same peocess DB as your “service” applications do.

Thanks for your answer! Just to clarify further for my use case, I would add the Camunda dependency to any of my services that would like to utilize the process engine. Once I’ve added the dependency, I would then add the bpmn files to the /resources folder in that service and these workflows will be uploaded to my process DB as process definitions. I would use one process DB between all of my application’s services.

I would then deploy Cockpit as a separate application and point it to my one process DB so that I can view and monitor running process instances across all of my services. Is my understanding on this correct?

Thanks!

Yes, your understanding is correct. But you don’t have to use the same process DB for all of your services. There are many things you should consider when deciding which service should use which camunda DB.

Awesome - I’ll do more research regarding what sort of set up I want for my camunda DB.

Regarding the separate Cockpit application, I’m currently using camunda-bpm-spring-boot-starter-webapp maven dependency for the Cockpit app. When I run the app, it mentions that it creates a process engine as seen in the following:

2021-03-14 16:03:43.592  INFO 48844 --- [           main] org.camunda.bpm.engine                   : ENGINE-00001 Process Engine engine created.
2021-03-14 16:03:43.592  INFO 48844 --- [           main] org.camunda.bpm.engine.jobexecutor       : ENGINE-14014 Starting up the JobExecutor[org.camunda.bpm.engine.impl.jobexecutor.DefaultJobExecutor].`
2021-03-14 16:03:43.594  INFO 48844 --- [ultJobExecutor]] org.camunda.bpm.engine.jobexecutor       : ENGINE-14018 JobExecutor[org.camunda.bpm.engine.impl.jobexecutor.DefaultJobExecutor] starting to acquire jobs
2021-03-14 16:03:43.912  INFO 48844 --- [           main] org.camunda.bpm.container                : ENGINE-08026 No processes.xml file found in process application 'processApplication'
2021-03-14 16:03:43.943  INFO 48844 --- [           main] org.camunda.bpm.container                : ENGINE-08050 Process application processApplication successfully deployed
2021-03-14 16:03:43.947  INFO 48844 --- [           main] c.t.pacbot.workflow.WorkflowApplication  : Started WorkflowApplication in 10.795 seconds (JVM running for 11.221)
2021-03-14 16:03:43.953  INFO 48844 --- [           main] org.camunda.bpm.engine.jobexecutor       : ENGINE-14014 Starting up the JobExecutor[org.camunda.bpm.engine.spring.components.jobexecutor.SpringJobExecutor].
2021-03-14 16:03:43.953  INFO 48844 --- [ingJobExecutor]] org.camunda.bpm.engine.jobexecutor       : ENGINE-14018 JobExecutor[org.camunda.bpm.engine.spring.components.jobexecutor.SpringJobExecutor] starting to acquire jobs

Shouldn’t the web app just create Camunda’s web applications (cockpit, admin, tasklist)? Or do I need to use a different maven dependency and not the webapp starter dependency?

In the cockpit app, you should deactivate the job executor. Besides, if you configure the engine with “deploymentAware=true” (and you should do this if you connect multiple apps with the same DB), then the cockpit’s engine will not pick any jobs anyway.

My cockpit app is still starting up JobExecutor despite deactivating the job executor in the my config. Here’s my SpringProcessengineConfiguration bean:

    @Bean
    public SpringProcessEngineConfiguration engineConfiguration(
            DataSource dataSource,
            PlatformTransactionManager transactionManager) {
        SpringProcessEngineConfiguration configuration = new SpringProcessEngineConfiguration();
        configuration.setDataSource(dataSource);
        configuration.setTransactionManager(transactionManager);
        configuration.setDatabaseSchemaUpdate("true");
        configuration.setJobExecutorActivate(false);
        configuration.setJobExecutorDeploymentAware(false);
        configuration.setHistory("full");
        return configuration;
    }

Regarding adding the Camunda dependency to my API services, I noticed the process engine tries to use port 8080. My APIs are also being hosted on port 8080. Does the Camunda process engine need to be hosted on port 8080? If not, where can I change the process engine port to use a different port number?

The engine does not use any port at all. What is using ports is the cockpit or maybe connetors, if you install them. But I think the thread has digressed from its original topic. I’d rather start another thread to discuss the cockpit.

Gotcha! I’ll mark your answer above as the solution and create a new thread to discuss the other issues I’m running into.

Thank you for your help!