A Camunda 8 example connector working with https://reqres.in/
- Element Template
- POM (artifact name, id, description)
- Connector Function
- Service Provider Interface (SPI)
Read more about creating Connectors
Check out the Connectors SDK
You can package the Connector by running:
mvn clean package
This will create the following artifacts:
- A thin JAR without dependencies.
- An fat JAR containing all dependencies, potentially shaded to avoid classpath conflicts. This will not include the SDK artifacts since those are in scope
provided
and will be brought along by the respective Connector Runtime executing the Connector.
You can use the maven-shade-plugin
defined in the Maven configuration to relocate common dependencies
that are used in other Connectors and the Connector Runtime.
This helps to avoid classpath conflicts when the Connector is executed.
Use the relocations
configuration in the Maven Shade plugin to define the dependencies that should be shaded.
The Maven Shade documentation
provides more details on relocations.
Name | Description | Example | Notes |
---|---|---|---|
page | controll page number to fetch | 2 |
Affects which entries will be returned |
per_page | Controll how many entries will be retruned per page | 3 |
Affcets the numbe rof entries on a page and the result set size |
"Response received: " + http response body
Response Body:
{"page":2,"per_page":3,"total":12,"total_pages":4,"data":[{"id":4,"email":"eve.holt@reqres.in","first_name":"Eve","last_name":"Holt","avatar":"https://reqres.in/img/faces/4-image.jpg"},{"id":5,"email":"charles.morris@reqres.in","first_name":"Charles","last_name":"Morris","avatar":"https://reqres.in/img/faces/5-image.jpg"},{"id":6,"email":"tracey.ramos@reqres.in","first_name":"Tracey","last_name":"Ramos","avatar":"https://reqres.in/img/faces/6-image.jpg"}],"support":{"url":"https://reqres.in/#support-heading","text":"To keep ReqRes free, contributions towards server costs are appreciated!"}}
Code | Description |
---|---|
FAIL | returns errro message of errro caught |
Run unit tests
mvn clean verify
Use the Camunda Connector Runtime to run your function as a local Java application.
In your IDE you can also simply navigate to the LocalContainerRuntime
class in test scope and run it via your IDE.
If necessary, you can adjust application.properties
in test scope.
The element template for this sample connector is generated automatically based on the connector
input class using the Element Template Generator.
The generation is embedded in the Maven build and can be triggered by running mvn clean package
.
It is not mandatory to generate the element template for your connector and you can also create it manually. However, the generator provides a convenient way to create the template and keep it in sync with the connector input class and empowers you to prototype and iterate quickly.
The generated element template can be found in element-templates/req-res-connector.json.