GithubHelp home page GithubHelp logo

rodriguemedor / camunda-http-connector-example Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rob2universe/camunda-http-connector-example

0.0 1.0 0.0 265 KB

License: Apache License 2.0

Java 100.00%

camunda-http-connector-example's Introduction

Camunda BPM http connector usage example

This example illustrates the invocation of a REST service from a service task in Camunda BPM using the http connector. The example uses a Camunda Spring Boot deployment but should work in the same way on other deployments.

No Java code is required. If you are comfortable with some Java / Spring then the recommended approach is to use a Spring bean instead of the connector, as shown in the example rest-service-task-spring. Spring beans are more flexible, e.g. allow to add custom error handling, and are easier testable.

The service invoked by the example is hosted at reqres.in. Many thanks to Ben Howdle for providing this developer playground.

This example illustrates how to

  • configure the connector
  • add the value of a process variable to the url
  • read a specific field from the REST service's JSON response using Camunda Spin
  • test the process from jUnit using Camunda BPM Assert

Also see related product documentation

The important parts

On the service task set the implementataion to "Connector". The set the connector properties (method, headers, url) on the appearing tab as shown. A response of type JSON can be read and navigated using JavaScript or an expression (shown). BPMN Process

BPMN Process

The prepackaged distribution includes everything needed.

If you are starting form a Spring Boot project, you need to include the dependencies for connect, http-client, Spin and Json:

   <dependencies>
...
    <dependency>
            <groupId>org.camunda.bpm</groupId>
            <artifactId>camunda-engine-plugin-connect</artifactId>
        </dependency>
        <dependency>
            <groupId>org.camunda.connect</groupId>
            <artifactId>camunda-connect-http-client</artifactId>
        </dependency>
        <dependency>
            <groupId>org.camunda.bpm</groupId>
            <artifactId>camunda-engine-plugin-spin</artifactId>
        </dependency>
        <dependency>
            <groupId>org.camunda.spin</groupId>
            <artifactId>camunda-spin-dataformat-json-jackson</artifactId>
        </dependency>
...
    </dependencies>

Unit Test

Run the jUnit test in your IDE or using:

mvn clean test

Step through the process manually

You can start the server using your IDE or

mvn spring-boot:run

and step through the process manually. After the server has started you can access the Camunda tasklist via http://localhost:8080/app/tasklist. Use the credentials demo / demo to login.

Run and inspect with Tasklist and Cockpit

Use tasklist and cockpit as described in the product documentation for

License

Apache License, Version 2.0.

camunda-http-connector-example's People

Contributors

rob2universe avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.