Demonstrates the operaton:connector mechanism: calling a REST endpoint without a Java delegate using the built-in HTTP connector, and registering a custom Connector SPI implementation.
- How to configure
operaton:connectorin BPMN (no Java code in the service task) - Input/output parameter mappings for connectors
- How to implement and register a custom
Connectorvia theConnectorProviderSPI (META-INF/services/org.operaton.connect.spi.ConnectorProvider) - How a BPMN boundary error event handles connector failures (unparseable response →
BpmnError)
The boundary error event is attached to ConvertAmount. Mermaid cannot render boundary event attachment directly; the error path is shown as a labelled edge from the task.
| Tool | Version |
|---|---|
| JDK | 21 |
| Docker | any recent |
# Make wrappers executable on macOS/Linux
chmod +x mvnw gradlew
docker compose up -d
./mvnw spring-boot:run
# or: ./gradlew bootRunCockpit/Tasklist: http://localhost:8080 (demo/demo)
Start a conversion via the REST API:
curl -X POST http://localhost:8080/engine-rest/process-definition/key/currency-conversion/start \
-H "Content-Type: application/json" \
-d '{
"variables": {
"exchangeRateServiceUrl": {"value": "https://example.com/rates/USD/EUR", "type": "String"},
"amount": {"value": 100, "type": "Double"}
}
}'- Start the process via the REST API above, supplying a real or mocked exchange-rate URL that returns a plain-text number (e.g.
0.92). - Open Cockpit → find the completed instance; inspect the
exchangeRateandconvertedAmountvariables. - Start again with a URL that returns a non-numeric body (or a 404 response). The instance ends at the Rate unavailable end event — the boundary error event on
ConvertAmountcatchesRATE_UNAVAILABLE.
currency-conversion.bpmn: two service tasks, each with anoperaton:connectorextension.FetchExchangeRateusesconnectorId="http-connector"(built-in). Input parameters:urlfrom${exchangeRateServiceUrl}andmethod=GET. Output: raw response body mapped to the process variableexchangeRate.ConvertAmountusesconnectorId="currency-convert". Input:amountandexchangeRate. Output:convertedAmount. If the exchange rate body cannot be parsed as a number, the connector throwsBpmnError("RATE_UNAVAILABLE"), which is caught by the boundary error event attached to this task.
connector/CurrencyConvertConnector.java: implementsAbstractConnector<CurrencyConvertRequest, CurrencyConvertResponse>. Parses the rate string; throwsBpmnErroronNumberFormatException.connector/CurrencyConvertConnectorProvider.java: implementsConnectorProvider, registered viaMETA-INF/services/org.operaton.connect.spi.ConnectorProvider.ConnectProcessEnginePluginis listed underoperaton.bpm.process-engine-pluginsinapplication.yamlto activate connector support.
./mvnw verify
# or: ./gradlew buildThe integration tests start PostgreSQL and WireMock in Testcontainers. Two tests are run: a successful conversion (asserts convertedAmount ≈ 92.0) and an invalid-rate response (asserts the process instance ends at the EndEvent_RateUnavailable end event).
