I recently started working on an application that uses Camunda. The application uses the Camunda as standalone (separate) application using its REST API, and of course it is very well documented, however, I noticed that sometimes there is a need to send a request from Camunda to the application.
If you have Spring Boot application which have running Camunda engine you could find many misleading information about how to configure Camunda to send REST request. If you using Camunda 7.7 (in camunda-bpm-spring-boot-starter-bom
this is current version) and Spring Boot 1.5 you can follow my description.
I have my Camunda application builded with Maven. This is relevant part of pom.xml
:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>1.5.6.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.camunda.bpm.extension.springboot</groupId>
<artifactId>camunda-bpm-spring-boot-starter-bom</artifactId>
<version>2.3.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.camunda.bpm.extension.springboot</groupId>
<artifactId>camunda-bpm-spring-boot-starter-rest</artifactId>
</dependency>
<!--HTTP-Client and REST Connector plugin -->
<dependency>
<groupId>org.camunda.bpm</groupId>
<artifactId>camunda-engine-plugin-connect</artifactId>
<version>7.7.0</version>
</dependency>
<dependency>
<groupId>org.camunda.connect</groupId>
<artifactId>camunda-connect-http-client</artifactId>
<version>1.0.4</version>
</dependency>
<repositories>
<repository>
<id>camunda-extensions-nexus</id>
<url>https://app.camunda.com/nexus/content/repositories/camunda-bpm-community-extensions-snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
As you can see I added camunda-engine-plugin-connect
and camunda-connect-http-client
.
Now let’s create REST request in service task using Camunda Modeller (have a look at red arrow):
Now configure request url:
…and type of method:
Time to configure headers:
…and of course you can provide payload:
This is it! You should now be able to send requests from Camunda service tasks to your application. Thanks for reading!