A Connector template for new C8 outbound connector
To use this template update the following resources to match the name of your connector:
- README (title, description)
- Element Template
- POM (artifact name, id, description)
- Connector Function (rename, implement, update
OutboundConnector
annotation)- Service Provider Interface (SPI) (rename)
...and delete this hint.
Read more about creating Connectors
Check out the Connectors SDK
Camunda Outbound Connector Template
Emulates a simple outbound connector function that takes a message and echoes it back.
The function will throw an exception if your message starts with fail
. This can be used to test error handling.
You can package the Connector by running the following command:
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 |
---|---|---|---|
username | Mock username | alice |
Has no effect on the function call outcome. |
token | Mock token value | my-secret-token |
Has no effect on the function call outcome. |
message | Mock message | Hello World |
Echoed back in the output. If starts with 'fail', an error will be thrown. |
{
"result": {
"myProperty": "Message received: ..."
}
}
Code | Description |
---|---|
FAIL | Message starts with 'fail' (ignoring case) |
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/template-connector.json.