Camunda REST
Experimental module
The experimental module is fully working and tested, but it requires additional validation and usage analysis.
For this reason, the API may undergo minor changes before it is considered fully stable.
The module connects Camunda 7 REST API to a Kora application and exposes the standard CamundaRestResources through a separate Undertow HTTP server.
It is used together with the Camunda 7 BPMN module: the BPMN engine executes processes, while the REST module provides HTTP access to Camunda 7 operations.
The module can also serve the OpenAPI description of the REST API, as well as Swagger UI and RapiDoc pages.
Requests to the REST API have separate settings for CORS, logging, metrics, tracing, and graceful server shutdown.
Dependency¶
Dependency build.gradle:
Module:
Dependency build.gradle.kts:
Module:
Requires the Camunda 7 BPMN module.
HTTP server¶
The module starts a separate, independent Undertow HTTP server dedicated to the Camunda 7 REST API.
It listens on its own port (default: 8081) and is completely isolated from the main HTTP server module:
it has its own CORS filter, its own telemetry, and its own graceful shutdown.
The Camunda REST API and the application's own controllers therefore run on different ports and do not share request handling or configuration.
The ProcessEngine that serves these requests is provided by the Camunda 7 BPMN module;
this module only exposes it over HTTP under the configured path (default: /engine-rest).
On shutdown, the server stops accepting new requests and waits up to shutdownWait (default: 30s)
for in-flight requests to complete before it terminates.
Configuration¶
Example of the complete configuration described by the CamundaRestConfig class:
camunda {
rest {
enabled = false //(1)!
path = "/engine-rest" //(2)!
port = 8081 //(3)!
shutdownWait = "30s" //(4)!
openapi {
file = [ "openapi.json" ] //(5)!
enabled = false //(6)!
endpoint = "/openapi" //(7)!
swaggerui {
enabled = false //(8)!
endpoint = "/swagger-ui" //(9)!
}
rapidoc {
enabled = false //(10)!
endpoint = "/rapidoc" //(11)!
}
}
cors {
enabled = false //(12)!
allowOrigin = "*" //(13)!
allowHeaders = [ "*" ] //(14)!
allowMethods = [ "GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS", "HEAD" ] //(15)!
allowCredentials = true //(16)!
exposeHeaders = [ "*" ] //(17)!
maxAge = "1h" //(18)!
}
telemetry {
logging {
enabled = false //(19)!
stacktrace = true //(20)!
mask = "***" //(21)!
maskQueries = [ ] //(22)!
maskHeaders = [ "authorization" ] //(23)!
pathTemplate = true //(24)!
}
metrics {
enabled = true //(25)!
slo = [ 1, 10, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000, 30000, 60000, 90000 ] //(26)!
tags = { // (27)!
"key1" = "value1"
"key2" = "value2"
}
}
tracing {
enabled = true //(28)!
attributes = { // (29)!
"key1" = "value1"
"key2" = "value2"
}
}
}
}
}
- Enables
Camunda 7 REST API(default:false). - Path prefix for
Camunda 7 REST API(default:/engine-rest). - Port of the separate
UndertowHTTP server for theREST API(default:8081). - Maximum time to wait for HTTP server graceful shutdown (default:
30s). - Path to the
OpenAPIfile inresources(default:[ "openapi.json" ]). By default, the file from thecamunda-engine-rest-openapidependency is used. - Enables the controller that serves the
OpenAPIfile (default:false). - Path where the
OpenAPIfile will be available (default:/openapi). - Enables the controller that serves
Swagger UI(default:false). - Path where
Swagger UIwill be available (default:/swagger-ui). - Enables the controller that serves
RapiDoc(default:false). - Path where
RapiDocwill be available (default:/rapidoc). - Enables the
CORSfilter (default:false). - Allowed origin for
CORS(default: not specified, optional). If the value is not specified, the filter uses the requestOriginheader, and if it is absent, returns*. - Allowed headers for
CORSrequests (default:[ "*" ]). - Allowed HTTP methods for
CORSrequests (default:[ "GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS", "HEAD" ]). - Allows credentials in
CORSrequests (default:true). - Headers exposed to the client in a
CORSresponse (default:[ "*" ]). - Maximum caching time for
CORSpreflight requests (default:1h). - Enables module logging (default:
false). - Enables stack trace logging when an exception occurs (default:
true). - Mask used to hide specified request or response headers and parameters (default:
***). - List of request parameters to hide in logs (default:
[ ]). - List of request or response headers to hide in logs (default:
[ "authorization" ]). - Defines whether the path template is used for logging (default: not specified, optional). If not specified, the full path is used only at the
TRACElogging level; iftrue, the path template is used; iffalse, the full path is used. - Enables module metrics (default:
true). - Configures SLO for the DistributionSummary metric (default:
ru.tinkoff.kora.telemetry.common.TelemetryConfig.MetricsConfig#DEFAULT_SLO). - Additional tags for metrics (default:
{}). - Enables module tracing (default:
true). - Additional attributes for tracing (default:
{}).
camunda:
rest:
enabled: false #(1)!
path: "/engine-rest" #(2)!
port: 8081 #(3)!
shutdownWait: "30s" #(4)!
openapi:
file: [ "openapi.json" ] #(5)!
enabled: false #(6)!
endpoint: "/openapi" #(7)!
swaggerui:
enabled: false #(8)!
endpoint: "/swagger-ui" #(9)!
rapidoc:
enabled: false #(10)!
endpoint: "/rapidoc" #(11)!
cors:
enabled: false #(12)!
allowOrigin: "*" #(13)!
allowHeaders: [ "*" ] #(14)!
allowMethods: [ "GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS", "HEAD" ] #(15)!
allowCredentials: true #(16)!
exposeHeaders: [ "*" ] #(17)!
maxAge: "1h" #(18)!
telemetry:
logging:
enabled: false #(19)!
stacktrace: true #(20)!
mask: "***" #(21)!
maskQueries: [ ] #(22)!
maskHeaders: [ "authorization" ] #(23)!
pathTemplate: true #(24)!
metrics:
enabled: true #(25)!
slo: [ 1, 10, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000, 30000, 60000, 90000 ] #(26)!
tags: #(27)!
key1: value1
key2: value2
tracing:
enabled: true #(28)!
attributes: #(29)!
key1: value1
key2: value2
- Enables
Camunda 7 REST API(default:false). - Path prefix for
Camunda 7 REST API(default:/engine-rest). - Port of the separate
UndertowHTTP server for theREST API(default:8081). - Maximum time to wait for HTTP server graceful shutdown (default:
30s). - Path to the
OpenAPIfile inresources(default:[ "openapi.json" ]). By default, the file from thecamunda-engine-rest-openapidependency is used. - Enables the controller that serves the
OpenAPIfile (default:false). - Path where the
OpenAPIfile will be available (default:/openapi). - Enables the controller that serves
Swagger UI(default:false). - Path where
Swagger UIwill be available (default:/swagger-ui). - Enables the controller that serves
RapiDoc(default:false). - Path where
RapiDocwill be available (default:/rapidoc). - Enables the
CORSfilter (default:false). - Allowed origin for
CORS(default: not specified, optional). If the value is not specified, the filter uses the requestOriginheader, and if it is absent, returns*. - Allowed headers for
CORSrequests (default:[ "*" ]). - Allowed HTTP methods for
CORSrequests (default:[ "GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS", "HEAD" ]). - Allows credentials in
CORSrequests (default:true). - Headers exposed to the client in a
CORSresponse (default:[ "*" ]). - Maximum caching time for
CORSpreflight requests (default:1h). - Enables module logging (default:
false). - Enables stack trace logging when an exception occurs (default:
true). - Mask used to hide specified request or response headers and parameters (default:
***). - List of request parameters to hide in logs (default:
[ ]). - List of request or response headers to hide in logs (default:
[ "authorization" ]). - Defines whether the path template is used for logging (default: not specified, optional). If not specified, the full path is used only at the
TRACElogging level; iftrue, the path template is used; iffalse, the full path is used. - Enables module metrics (default:
true). - Configures SLO for the DistributionSummary metric (default:
ru.tinkoff.kora.telemetry.common.TelemetryConfig.MetricsConfig#DEFAULT_SLO). - Additional tags for metrics (default:
{}). - Enables module tracing (default:
true). - Additional attributes for tracing (default:
{}).
The listing above shows every available option; in practice you enable only what you need.
A typical setup exposes the REST API on a custom port together with the OpenAPI description, Swagger UI, and request logging:
OpenAPI¶
Besides the REST API itself, the separate server can serve the API's OpenAPI description together with
Swagger UI and RapiDoc pages.
All three are disabled by default and are enabled independently through the openapi configuration section.
When enabled, the pages are available on the REST server port at the configured endpoints:
| Page | Configuration flag | Default endpoint |
|---|---|---|
| OpenAPI spec | openapi.enabled |
/openapi |
| Swagger UI | openapi.swaggerui.enabled |
/swagger-ui |
| RapiDoc | openapi.rapidoc.enabled |
/rapidoc |
For example, with port = 8090 and openapi.enabled = true the specification is served at http://localhost:8090/openapi,
and Swagger UI (when enabled) at http://localhost:8090/swagger-ui.
By default the module serves the OpenAPI specification bundled with the
camunda-engine-rest-openapi dependency.
When this bundled specification is used, the module substitutes the configured port and path into it,
so the served OpenAPI always matches the live REST API address even when values other than 8081 or /engine-rest are configured.
To serve a custom specification instead, point openapi.file at one or more files in resources:
CORS¶
The REST server has its own CORS filter, disabled by default and enabled through cors.enabled.
When cors.allowOrigin is not set, the filter reflects the request Origin header back in the response,
falling back to * when the request carries no Origin header.
The remaining cors.* options control the allowed headers and methods, whether credentials are allowed,
the headers exposed to the client, and the preflight cache duration.
Telemetry¶
Requests handled by the REST server are covered by the standard Kora telemetry signals — logging,
metrics, and tracing — configured under the telemetry section.
Logging is disabled by default (telemetry.logging.enabled), while metrics and tracing are enabled by default.
The telemetry.logging.pathTemplate option controls how the request path appears in logs: when it is not set,
the path template is used except at the TRACE level, where the full path is logged;
true always uses the path template, and false always uses the full path.
Module metrics are described in the Metrics Reference section.
The default telemetry can be overridden by registering your own CamundaRestLoggerFactory, CamundaRestMetricsFactory,
or CamundaRestTracerFactory component, which replaces the corresponding default provided via @DefaultComponent.
Applications¶
The module already registers a default @Tag(CamundaRest.class) jakarta.ws.rs.core.Application that exposes the standard
Camunda 7 REST API resources (CamundaRestResources) together with a ResteasyJackson2Provider for JSON serialization.
To add custom JAX-RS resources, register your own jakarta.ws.rs.core.Application component marked with the @Tag(CamundaRest.class) tag.
All such applications are collected and merged with the default one — their getClasses() and getSingletons() are combined —
so custom resources are served on the same REST server alongside the standard Camunda endpoints.