How can Spring Boot project connect to remote Camunda using REST API?

Hi!

I need to develop a project which uses Spring Boot with embedded Camunda. One of my tasks is to use the remote Camunda instead of the embedded one.

I tried the following steps.

  • Download the Camunda BPM Run, run on my laptop as remote Camunda

  • Change from camunda-bpm-spring-boot-starter to camunda-engine-rest-core in pom.xml

  • Update our service methods using the Camunda REST methods (E.g DeploymentRestService)

Here comes the problem. After updating all the service methods, I can’t find a way to pass the remote Camunda URL information. Dependency injections of the Camunda REST methods are not working as well. There seems a gap between our Spring Boot project and the Camunda Engine REST Core library. Why there’re no docs or tutorials that are similar to my scenario? Am I doing wrong?

I’m also checking camunda-bpm-spring-boot-starter-rest. It seems to provide both embedded and REST ways. Again, I can’t find any docs that can show a complete sample flow. Can someone please help me with it? Thank you.

https://camunda-community-hub.github.io/camunda-rest-client-spring-boot/snapshot/getting-started.html

Note: There are some broken link, but this will help you start connecting to remote Camunda Engine.

1 Like

Thanks for the reply. I already checked it. It seems one of the solutions for me. But I’m wondering if someone using camunda-engine-rest-core in the Spring Boot project to connect with the remote Camunda. I feel like it’s not directly implementable in the Spring Boot project. But I don’t know where to verify it.

Hi @Niall. Sorry to interrupt you. I don’t know whom I can mention here. Hope you don’t mind. Could you please read my post and point me somewhere to verify if my approach is correct? Thank you.

I’m a little big confused about what is it you’re trying to do.
You have Camunda Run and you also have a spring boot application with the engine as well?
How are they related?

Thanks for the reply. I’m working on a Spring Boot project with the embedded engine. But we won’t use that embedded one anymore. We will set up the standalone Camunda on the server. So that standalone Camunda and the backend (Spring Boot) project will be hosted on the different cloud servers. They need to communicate with each other via REST. That’s our plan.

I’m now using camunda-engine-rest-core lib as I said above. I would like to know how I can properly apply that core lib in the Spring Boot project. Or do I need to change my approach for my scenario? I checked here: Camunda BPM Examples. Nothing is similar to my case.

I you want to add the camunda engine and rest api to a spring boot project you should add this

    <dependency>
      <groupId>org.camunda.bpm.springboot</groupId>
      <artifactId>camunda-bpm-spring-boot-starter-rest</artifactId>
    </dependency>

If you also want the webapps you can add:

    <dependency>
      <groupId>org.camunda.bpm.springboot</groupId>
      <artifactId>camunda-bpm-spring-boot-starter-webapp</artifactId>
    </dependency>

camunda-bpm-spring-boot-starter-rest allows a Spring Boot project to be accessible via REST. Does it also allow to connect to a remote standalone Camunda via REST?

There’s nothing you’d need to need to to do the spring boot application to let it connect via rest to Camunda Run - you just need to make the call.
What sort of communication are you looking to make?

Right. But I’m using the camunda-engine-rest-core lib which provides REST service methods and POJOs. I’m trying to use them instead of making the normal REST calls. It looks like I need to implement normal REST calls. So, what are the REST service methods in camunda-engine-rest-core lib for?

You can’t use a camunda lib. They have dependencies on the engine jar(s), and would cause you problems. You basically need to use something like Spring’s RestTemplate to manually invoke the REST api in the camunda app:
https://docs.camunda.org/manual/current/reference/rest/process-definition/post-start-process-instance/

i basically ended up copying the dto’s manually from camunda rest jar to our app

1 Like

Hi. Yes, I’m now using Spring WebClient and Camunda REST API. It works. DTO classes from Camunda REST Core Lib are perfectly matched with the responses. I thought I might need to create them manually to handle the responses. Thanks for your reply.