diff --git a/.github/settings.xml b/.github/settings.xml new file mode 100644 index 0000000..a36deb0 --- /dev/null +++ b/.github/settings.xml @@ -0,0 +1,12 @@ + + + + central + ${env.MAVEN_CENTRAL_USERNAME} + ${env.MAVEN_CENTRAL_TOKEN} + + + diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..1aa6f0c --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,183 @@ +# Release pipeline for zenbpm-java-client. +# Triggered via repository_dispatch from zenbpm (pulls fresh api.yaml, builds, +# deploys, commits api.yaml back) or manually via: +# gh workflow run release.yaml --ref --field release_tag=vX.Y.Z +# Manual mode deploys whatever is checked in — for testing and ad-hoc releases. + +name: Release to Maven Central + +on: + repository_dispatch: + types: [release_published] + workflow_dispatch: + inputs: + release_tag: + description: 'Version to release (e.g., v1.2.0, v1.2.1-fix1, v1.3.0-SNAPSHOT)' + required: true + type: string + +# Only one release per tag in flight at a time — prevents racing on push +# or stepping on the shared GPG keyring. +concurrency: + group: release-${{ github.event.client_payload.release_tag || github.event.inputs.release_tag || github.run_id }} + cancel-in-progress: false + +permissions: + contents: write + +env: + # Build on JDK 17; pom.xml targets Java 8 bytecode. + JAVA_VERSION: '17' + MAVEN_CLI_OPTS: '-B -ntp' + ZENBPM_REPO: 'pbinitiative/zenbpm' + API_YAML_PATH: 'zenbpm-client-core/src/main/resources/openapi/api.yaml' + +jobs: + release: + runs-on: ubuntu-latest + + steps: + - name: Determine release version + id: version + run: | + case "${{ github.event_name }}" in + repository_dispatch) + VERSION="${{ github.event.client_payload.release_tag }}" + ;; + workflow_dispatch) + VERSION="${{ github.event.inputs.release_tag }}" + ;; + esac + + if ! echo "${VERSION}" | grep -qE '^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$'; then + echo "ERROR: version '${VERSION}' does not match vX.Y.Z[-suffix] format" + exit 1 + fi + + echo "VERSION=${VERSION}" + echo "version=${VERSION}" >> "$GITHUB_OUTPUT" + echo "version_no_v=${VERSION#v}" >> "$GITHUB_OUTPUT" + + - name: Checkout zenbpm-java-client + uses: actions/checkout@v4 + with: + fetch-depth: 1 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up JDK ${{ env.JAVA_VERSION }} + uses: actions/setup-java@v4 + with: + java-version: ${{ env.JAVA_VERSION }} + distribution: temurin + cache: maven + + # Auto-only: manual runs deploy whatever api.yaml is checked in. + - name: Pull api.yaml from zenbpm ${{ steps.version.outputs.version }} + if: github.event_name == 'repository_dispatch' + run: | + set -euo pipefail + echo "Cloning ${{ env.ZENBPM_REPO }} at tag ${{ steps.version.outputs.version }}..." + git clone --depth 1 --branch "${{ steps.version.outputs.version }}" \ + "https://github.com/${{ env.ZENBPM_REPO }}.git" /tmp/zenbpm + + echo "Copying api.yaml..." + cp /tmp/zenbpm/openapi/api.yaml "${{ env.API_YAML_PATH }}" + + if [ ! -s "${{ env.API_YAML_PATH }}" ]; then + echo "ERROR: copied api.yaml is empty or missing" + exit 1 + fi + echo "api.yaml size: $(wc -c < "${{ env.API_YAML_PATH }}") bytes" + echo "--- api.yaml diff (vs. HEAD) ---" + git diff --stat -- "${{ env.API_YAML_PATH }}" || true + + - name: Set project version to match tag + run: | + mvn ${MAVEN_CLI_OPTS} \ + versions:set \ + -DnewVersion="${{ steps.version.outputs.version_no_v }}" \ + -DgenerateBackupPoms=false + + - name: Build & run tests + run: mvn ${MAVEN_CLI_OPTS} clean verify -Dgpg.skip=true + + # Pre-load passphrase into gpg-agent rather than passing on CLI or as + # system property — both leak via /proc or debug logs. + - name: Import GPG key & prime gpg-agent + run: | + set -euo pipefail + + printf '%s' "${{ secrets.MAVEN_GPG_PRIVATE_KEY }}" | gpg --batch --import + + # allow-loopback-pinentry + allow-preset-passphrase are both needed + # for non-interactive signing in headless CI. + mkdir -p "${HOME}/.gnupg" + printf 'allow-loopback-pinentry\nallow-preset-passphrase\n' \ + > "${HOME}/.gnupg/gpg-agent.conf" + gpgconf --kill gpg-agent 2>/dev/null || true + gpgconf --launch gpg-agent + + # Pre-cache passphrase via stdin — never on the CLI. + KEYGRIPS=$(gpg --list-secret-keys --with-keygrip --keyid-format LONG \ + | grep -oP 'Keygrip = \K[A-F0-9]+') + if [ -z "${KEYGRIPS:-}" ]; then + echo "ERROR: could not find any secret key keygrips after import" + exit 1 + fi + if ! PRESET_CMD=$(command -v gpg-preset-passphrase); then + if [ -x /usr/lib/gnupg2/gpg-preset-passphrase ]; then + PRESET_CMD=/usr/lib/gnupg2/gpg-preset-passphrase + else + echo "ERROR: gpg-preset-passphrase not found" + exit 1 + fi + fi + + for kg in ${KEYGRIPS}; do + printf '%s' "${{ secrets.MAVEN_GPG_PASSPHRASE }}" \ + | "${PRESET_CMD}" --preset "${kg}" + done + + echo "--- imported keys ---" + gpg --list-secret-keys --keyid-format LONG + + # No GPG_PASSPHRASE here — the agent (primed above) supplies it. + - name: Deploy to Maven Central + env: + MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} + MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }} + run: | + set -euo pipefail + mvn ${MAVEN_CLI_OPTS} deploy \ + -P release \ + -DskipTests \ + -Dgpg.skip=false \ + --settings .github/settings.xml + + # Auto-only: manual runs don't change api.yaml. + - name: Commit updated api.yaml + if: github.event_name == 'repository_dispatch' + run: | + set -euo pipefail + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + git add -- "${{ env.API_YAML_PATH }}" + if git diff --cached --quiet -- "${{ env.API_YAML_PATH }}"; then + echo "No changes to commit — api.yaml is already up to date." + exit 0 + fi + + # Rebase on concurrent changes so two dispatch events for the same + # tag don't race each other on push. + git pull --rebase --autostash origin HEAD + git commit -m "chore: update api.yaml from zenbpm ${{ steps.version.outputs.version }}" + git push origin HEAD + + - name: Notify on failure + if: failure() + run: | + { + echo "::error title=Release ${{ steps.version.outputs.version }} failed::See run logs." + echo "Run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + } >> "${GITHUB_STEP_SUMMARY}" diff --git a/.gitignore b/.gitignore index 13fbea8..74842b0 100644 --- a/.gitignore +++ b/.gitignore @@ -87,6 +87,7 @@ local.properties # Created by git for backups. To disable backups in Git: # $ git config --global mergetool.keepBackup false *.orig +.worktree # Created by git when using merge tools for conflicts *.BACKUP.* diff --git a/README.md b/README.md index 09e4f5f..65fef70 100644 --- a/README.md +++ b/README.md @@ -14,25 +14,47 @@ ## Build this project ``mvn clean package`` -## Getting started +## Using the library -Add the starter to your application and the core client as needed. +Artifacts are published to **Maven Central** under the `org.pbinitiative.zenbpm` namespace. + +### Add the dependencies + +Latest release: **1.3.0** -Maven: ```xml + + 1.3.0 + + + - org.zenbpm + org.pbinitiative.zenbpm zenbpm-spring-boot-starter - ${project.version} + ${zenbpm.version} + + - org.zenbpm + org.pbinitiative.zenbpm zenbpm-client-core - ${project.version} + ${zenbpm.version} + + + + + io.grpc + grpc-netty-shaded + 1.78.0 + runtime ``` -Configure connection settings in application.yml +## Configuration + +Configure connection settings in `application.yml`. values shown in `zenbpm` section are defaults. @@ -49,13 +71,14 @@ zenbpm: grpcLoggingEnabled: true jobWorkerEnabled: true +# Disable OpenTelemetry — this is an OpenTelemetry SDK property, not a library property. otel.sdk.disabled: true - + logging: level: root: INFO - org.zenbpm.rest: TRACE - org.zenbpm.grpc: DEBUG + org.pbinitiative.zenbpm.rest: TRACE + org.pbinitiative.zenbpm.grpc: DEBUG ``` @@ -67,13 +90,15 @@ Inject the provided ZenbpmClientService to obtain the ApiClient, then create a t ```java import org.springframework.stereotype.Service; import org.springframework.beans.factory.annotation.Autowired; -import org.zenbpm.rest.ZenbpmClientService; -import org.zenbpm.client.ApiException; -import org.zenbpm.client.ApiClient; -import org.zenbpm.client.api.ProcessDefinitionApi; -import org.zenbpm.client.api.ProcessInstanceApi; -import org.zenbpm.client.api.dto.CreateProcessInstanceRequest; - +import org.pbinitiative.zenbpm.rest.ZenbpmClientService; +import org.pbinitiative.zenbpm.client.ApiException; +import org.pbinitiative.zenbpm.client.ApiClient; +import org.pbinitiative.zenbpm.client.api.ProcessDefinitionApi; +import org.pbinitiative.zenbpm.client.api.ProcessInstanceApi; +import org.pbinitiative.zenbpm.client.api.dto.CreateProcessInstanceRequest; +import org.pbinitiative.zenbpm.client.api.dto.ProcessInstance; + +import java.io.File; import java.util.HashMap; import java.util.Map; @@ -86,13 +111,11 @@ public class MyService { ApiClient apiClient = zenbpm.getApiClient(); ProcessDefinitionApi defApi = new ProcessDefinitionApi(apiClient); - // Example: create a process definition from a BPMN string (adjust to your endpoint contract) - String bpmnXml = "..."; - Long definitionKey = defApi.createProcessDefinition(bpmnXml).getProcessDefinitionKey(); - return definitionKey; + File bpmnFile = new File("path/to/process.bpmn"); + return defApi.createProcessDefinition(bpmnFile).getProcessDefinitionKey(); } - public void startMyProcess() throws ApiException { + public ProcessInstance startMyProcess(Long definitionKey) throws ApiException { ApiClient apiClient = zenbpm.getApiClient(); ProcessInstanceApi piApi = new ProcessInstanceApi(apiClient); @@ -100,31 +123,31 @@ public class MyService { vars.put("orderId", 12345L); CreateProcessInstanceRequest req = new CreateProcessInstanceRequest() - .processDefinitionKey(123456L) + .processDefinitionKey(definitionKey) .variables(vars); - piApi.createProcessInstance(req); + return piApi.createProcessInstance(req); } } ``` Notes: - Available typed APIs include ProcessDefinitionApi, ProcessInstanceApi, JobApi, MessageApi, etc. Construct them with the provided ApiClient. -- Methods and DTOs come from the generated package `org.zenbpm.client.api` and `org.zenbpm.client.api.dto`. +- Methods and DTOs come from the generated package `org.pbinitiative.zenbpm.client.api` and `org.pbinitiative.zenbpm.client.api.dto`. ### 2) Register a gRPC job worker Create a Spring bean with a method annotated by `@JobWorker`. Accepted method signatures: - no parameters -- one parameter of type `org.zenbpm.proto.Zenbpm.WaitingJob` -- one parameter of type `org.zenbpm.grpc.JobContext` +- one parameter of type `org.pbinitiative.zenbpm.proto.Zenbpm.WaitingJob` +- one parameter of type `org.pbinitiative.zenbpm.grpc.JobContext` - one parameter of type `Map` Return value can be any object and will be serialized as variables for job completion. Throwing an exception fails the job. ```java import org.springframework.stereotype.Component; -import org.zenbpm.grpc.JobWorker; -import org.zenbpm.grpc.JobContext; +import org.pbinitiative.zenbpm.grpc.JobWorker; +import org.pbinitiative.zenbpm.grpc.JobContext; import java.util.Map; import java.util.HashMap; @@ -149,5 +172,18 @@ The gRPC worker manager connects on application start if `zenbpm.jobWorkerEnable --- +## Releasing a new version + +Releases are automated via GitHub Actions (`.github/workflows/release.yaml`): + +- **Automatic:** Triggered by a `repository_dispatch` event from the [zenbpm](https://github.com/pbinitiative/zenbpm) repo after a new release is published. The workflow pulls the matching `api.yaml`, builds, deploys to Maven Central, and commits the new `api.yaml` back here. +- **Manual:** For ad-hoc releases and end-to-end testing of the deploy pipeline, run from the repo root: + ``` + gh workflow run release.yaml --ref --field release_tag=vX.Y.Z + ``` + This skips the `api.yaml` pull and deploys whatever is currently checked in. + +Required secrets: `MAVEN_GPG_PRIVATE_KEY`, `MAVEN_GPG_PASSPHRASE`, `MAVEN_CENTRAL_USERNAME`, `MAVEN_CENTRAL_TOKEN`. + Feel free to open issues or pull requests if you find bugs or want new features. diff --git a/pom.xml b/pom.xml index 4d1f2a5..298bea8 100644 --- a/pom.xml +++ b/pom.xml @@ -3,11 +3,36 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.zenbpm + + org.pbinitiative.zenbpm zenbpm-java-client - v0.3.9 + 1.3.0 pom + ZenBPM Java Client + Spring Boot starter and core REST/gRPC client for the ZenBPM process engine. + https://github.com/pbinitiative/zenbpm-java-client + + + + MIT License + https://opensource.org/licenses/MIT + + + + + + pbinitiative + https://github.com/pbinitiative + + + + + scm:git:https://github.com/pbinitiative/zenbpm-java-client.git + scm:git:https://github.com/pbinitiative/zenbpm-java-client.git + https://github.com/pbinitiative/zenbpm-java-client + + zenbpm-client-core zenbpm-spring-boot-starter @@ -15,5 +40,100 @@ 8 + UTF-8 + 3.3.1 + 3.11.2 + 3.2.7 + true + + + + + + org.apache.maven.plugins + maven-source-plugin + ${maven-source-plugin.version} + + + attach-sources + + jar-no-fork + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + ${maven-javadoc-plugin.version} + + none + + + + attach-javadocs + + jar + + + + + + + + org.apache.maven.plugins + maven-gpg-plugin + ${maven-gpg-plugin.version} + + + sign-artifacts + verify + + sign + + + ${gpg.skip} + + --pinentry-mode + loopback + + + + + + + + + + + + + release + + + + org.sonatype.central + central-publishing-maven-plugin + 0.8.0 + true + + central + true + published + zenbpm-java-client-${project.version} + + + + + + diff --git a/zenbpm-client-core/pom.xml b/zenbpm-client-core/pom.xml index 33778f5..6f23df2 100644 --- a/zenbpm-client-core/pom.xml +++ b/zenbpm-client-core/pom.xml @@ -4,13 +4,37 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.zenbpm + org.pbinitiative.zenbpm zenbpm-java-client - v0.3.9 + 1.3.0 zenbpm-client-core + ZenBPM Java Client - Core + Core REST and gRPC client for the ZenBPM process engine. + https://github.com/pbinitiative/zenbpm-java-client + + + + MIT License + https://opensource.org/licenses/MIT + + + + + + pbinitiative + https://github.com/pbinitiative + + + + + scm:git:https://github.com/pbinitiative/zenbpm-java-client.git + scm:git:https://github.com/pbinitiative/zenbpm-java-client.git + https://github.com/pbinitiative/zenbpm-java-client + + ${java.version} ${java.version} @@ -120,8 +144,8 @@ ${project.basedir}/src/main/resources/openapi/api.yaml java - org.zenbpm.client.api - org.zenbpm.client.api.dto + org.pbinitiative.zenbpm.client.api + org.pbinitiative.zenbpm.client.api.dto true false false @@ -136,6 +160,7 @@ java8 true false + false diff --git a/zenbpm-client-core/src/main/resources/openapi/api.yaml b/zenbpm-client-core/src/main/resources/openapi/api.yaml index 1d665d1..fe5782e 100644 --- a/zenbpm-client-core/src/main/resources/openapi/api.yaml +++ b/zenbpm-client-core/src/main/resources/openapi/api.yaml @@ -3,7 +3,7 @@ openapi: 3.0.0 info: title: ZenBPM OpenAPI description: REST API for ZenBPM - version: 0.1.0 + version: 1.3.0 contact: name: API Support email: info@pbinitiative.org @@ -19,6 +19,7 @@ tags: - name: process-instance - name: dmn-resource-definition - name: decision-definition + - name: decision-instance - name: job - name: message - name: incident @@ -60,14 +61,31 @@ paths: format: int64 example: dmnResourceDefinitionKey: 4503599627370495 + 200: + description: > + DMN resource definition with the same dmnResourceDefinitionId and version already exists + and the content is identical — deployment ignored, returns the key of the existing definition. + If the content differs for the same ID and version, a new version is deployed and 201 is returned instead. + content: + application/json: + schema: + type: object + required: + - dmnResourceDefinitionKey + properties: + dmnResourceDefinitionKey: + type: integer + format: int64 + example: + dmnResourceDefinitionKey: 4503599627370495 400: description: Bad request content: application/json: schema: $ref: "#/components/schemas/Error" - 409: - description: Conflict - dmn resource definition already exists + 500: + description: Internal server error content: application/json: schema: @@ -104,6 +122,34 @@ paths: default: 10 description: Number of items per page (max 100) example: 10 + - name: onlyLatest + in: query + schema: + type: boolean + default: false + description: If true, returns only the latest version of each DMN resource definition grouped by dmnResourceDefinitionId + - name: sortBy + in: query + schema: + type: string + enum: [dmnDefinitionName, dmnResourceDefinitionId, version, key] + description: Sort field + - $ref: "#/components/parameters/sortOrder" + - name: dmnResourceDefinitionId + in: query + schema: + type: string + description: Filter by DMN resource definition ID to get all versions + - name: dmnDefinitionName + in: query + schema: + type: string + description: Filter by name (partial match) + - name: search + in: query + schema: + type: string + description: Search by DMN resource definition ID or DMN definition name responses: 200: description: List of dmn resource definitions @@ -113,19 +159,30 @@ paths: $ref: "#/components/schemas/DmnResourceDefinitionsPage" example: items: - - key: "4503599627370495" - version: 1 - decisionDefinitionId: "loan-approval" - - key: "4503599627370496" + - key: 4503599627370496 version: 2 - decisionDefinitionId: "loan-approval" - - key: "4503599627370497" + dmnResourceDefinitionId: "loan-approval" + dmnDefinitionName: "Loan Approval Decision" + - key: 4503599627370497 version: 1 - decisionDefinitionId: "credit-score-check" + dmnResourceDefinitionId: "credit-score-check" + dmnDefinitionName: "Credit Score Check" page: 1 size: 10 - count: 3 - totalCount: 3 + count: 2 + totalCount: 2 + 400: + description: Bad request + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + 500: + description: Internal server error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" 502: description: Failed to redirect request to responsible node content: @@ -155,9 +212,10 @@ paths: schema: $ref: "#/components/schemas/DmnResourceDefinitionDetail" example: - key: "4503599627370495" - version: 1 - decisionDefinitionId: "loan-approval" + key: 4503599627370495 + version: 2 + dmnResourceDefinitionId: "loan-approval" + dmnDefinitionName: "Loan Approval Decision" dmnData: | @@ -171,6 +229,18 @@ paths: application/json: schema: $ref: "#/components/schemas/Error" + 404: + description: Not found + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + 500: + description: Internal server error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" 502: description: Failed to redirect request to responsible node content: @@ -206,7 +276,7 @@ paths: - latest - deployment #TODO: unsupported - versionTag - decisionDefinitionId: + dmnResourceDefinitionId: description: Can be used in combination with bindingType latest type: string versionTag: @@ -233,7 +303,7 @@ paths: decisionType: "DECISION_TABLE" decisionDefinitionVersion: 1 dmnResourceDefinitionKey: 4503599627370495 - decisionDefinitionId: "loan-approval" + dmnResourceDefinitionId: "loan-approval" matchedRules: - ruleId: "rule1" ruleIndex: 0 @@ -252,12 +322,247 @@ paths: inputExpression: "income" inputValue: { "income": 50000 } decisionOutput: { "approved": true } + 400: + description: Bad request + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + code: "BAD_REQUEST" + message: "The request parameters are invalid" + 404: + description: Not Found (e.g. decision definition was not found) + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + code: "NOT_FOUND" + message: "No decision definition found for the given decisionId" + 500: + description: Internal server error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + code: "INTERNAL_SERVER_ERROR" + message: "An unexpected error occurred while evaluating the decision" + 502: + description: Failed to redirect request to responsible node + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + code: "BAD_GATEWAY" + message: "Failed to redirect request to responsible node" + + /decision-instances: + get: + operationId: getDecisionInstances + summary: Get list of decision instances + tags: + - decision-instance + parameters: + - name: dmnResourceDefinitionKey + in: query + schema: + type: integer + format: int64 + description: Filter by DMN resource definition key + - name: dmnResourceDefinitionId + in: query + schema: + type: string + description: Filter by DMN resource definition ID + - name: processInstanceKey + in: query + schema: + type: integer + format: int64 + description: Filter by process instance + - name: evaluatedFrom + in: query + schema: + type: string + format: date-time + description: Filter - evaluated after this date + - name: evaluatedTo + in: query + schema: + type: string + format: date-time + description: Filter - evaluated before this date + - name: page + in: query + schema: + type: integer + format: int32 + minimum: 1 + default: 1 + description: Page number (1-based indexing) + - name: size + in: query + schema: + type: integer + format: int32 + minimum: 1 + maximum: 100 + default: 10 + description: Number of items per page (max 100) + - name: sortBy + in: query + schema: + type: string + enum: [evaluatedAt, key] + description: Sort field + - $ref: "#/components/parameters/sortOrder" + responses: + 200: + description: List of decision instances + content: + application/json: + schema: + $ref: "#/components/schemas/DecisionInstancePartitionPage" + example: + partitions: + - partition: 1 + count: 156 + items: + - key: 4503599627370600 + dmnResourceDefinitionKey: 4503599627370495 + dmnResourceDefinitionId: "loan-approval" + processInstanceKey: 4503599627370501 + flowElementInstanceKey: 4503599627370550 + evaluatedAt: "2025-08-22T14:30:25Z" + inputCount: 3 + outputCount: 2 + - partition: 2 + count: 98 + items: + - key: 9007199254740995 + dmnResourceDefinitionKey: 4503599627370495 + dmnResourceDefinitionId: "loan-approval" + processInstanceKey: 9007199254740992 + flowElementInstanceKey: 9007199254740980 + evaluatedAt: "2025-08-22T15:45:33Z" + inputCount: 3 + outputCount: 2 + page: 1 + size: 10 + count: 2 + totalCount: 254 + 400: + description: Bad request + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + code: "BAD_REQUEST" + message: "The request parameters are invalid" + 500: + description: Internal server error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + code: "INTERNAL_SERVER_ERROR" + message: "An unexpected error occurred while retrieving decision instances" + 502: + description: Failed to collect data from responsible nodes + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + code: "BAD_GATEWAY" + message: "Failed to collect data from responsible nodes" + + /decision-instances/{decisionInstanceKey}: + get: + operationId: getDecisionInstance + summary: Get decision instance details + tags: + - decision-instance + parameters: + - name: decisionInstanceKey + in: path + required: true + schema: + type: integer + format: int64 + example: 4503599627370600 + responses: + 200: + description: Decision instance details + content: + application/json: + schema: + $ref: "#/components/schemas/DecisionInstanceDetail" + example: + key: 4503599627370600 + dmnResourceDefinitionKey: 4503599627370495 + dmnResourceDefinitionId: "loan-approval" + dmnResourceDefinitionVersion: 1 + processInstanceKey: 4503599627370501 + flowElementInstanceKey: 4503599627370550 + evaluatedAt: "2025-08-22T14:30:25Z" + decisionRequirementsKey: 4503599627370490 + decisionRequirementsId: "loan-drd" + evaluatedDecisions: + - decisionId: "loan-approval" + decisionName: "Loan Approval" + decisionType: "DECISION_TABLE" + evaluationOrder: 1 + inputs: + - inputId: "input_amount" + inputName: "Loan Amount" + inputExpression: "loanAmount" + inputValue: 50000 + outputs: + - outputId: "output_approved" + outputName: "Approved" + outputValue: true + matchedRules: + - ruleId: "rule_1" + ruleIndex: 0 + evaluatedOutputs: + - outputId: "output_approved" + outputName: "Approved" + outputValue: true + decisionOutput: + approved: true + 404: + description: Decision instance not found + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + code: "NOT_FOUND" + message: "No decision instance found for the given key" 500: description: Internal server error content: application/json: schema: $ref: "#/components/schemas/Error" + example: + code: "INTERNAL_SERVER_ERROR" + message: "An unexpected error occurred while retrieving decision instance" + 502: + description: Failed to collect data from responsible node + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + code: "BAD_GATEWAY" + message: "Failed to collect data from responsible node" /process-definitions: post: @@ -268,17 +573,19 @@ paths: requestBody: required: true content: - application/xml: + multipart/form-data: schema: - type: string - format: xml - example: | - - - - ... - - + type: object + required: + - resource + properties: + resource: + type: string + format: binary + description: BPMN process definition file (.bpmn format only, max 4MB) + encoding: + resource: + contentType: application/octet-stream responses: 201: description: Process definition deployed @@ -294,24 +601,50 @@ paths: format: int64 example: processDefinitionKey: 4503599627370498 + 200: + description: > + Process definition with the same BPMN process ID and version already exists + and the content is identical — deployment ignored, returns the key of the existing definition. + If the content differs for the same ID and version, a new version is deployed and 201 is returned instead. + content: + application/json: + schema: + type: object + required: + - processDefinitionKey + properties: + processDefinitionKey: + type: integer + format: int64 + example: + processDefinitionKey: 4503599627370498 400: description: Bad request content: application/json: schema: $ref: "#/components/schemas/Error" - 409: - description: Conflict - process definition already exists + example: + code: "BAD_REQUEST" + message: "The provided BPMN file is invalid: missing required 'process' element" + 500: + description: Internal server error content: application/json: schema: $ref: "#/components/schemas/Error" + example: + code: "INTERNAL_SERVER_ERROR" + message: "An unexpected error occurred while processing the BPMN file" 502: description: Failed to redirect request to responsible node content: application/json: schema: $ref: "#/components/schemas/Error" + example: + code: "BAD_GATEWAY" + message: "Failed to redirect request to responsible node" get: operationId: getProcessDefinitions summary: Get list of process definitions @@ -337,6 +670,29 @@ paths: default: 10 description: Number of items per page (max 100) example: 10 + - name: onlyLatest + in: query + schema: + type: boolean + default: false + description: If true, returns only the latest version of each process definition grouped by bpmnProcessId + - name: sortBy + in: query + schema: + type: string + enum: [name, bpmnProcessId, bpmnProcessName, version, key] + description: Sort field + - $ref: "#/components/parameters/sortOrder" + - name: bpmnProcessId + in: query + schema: + type: string + description: Filter by BPMN process ID to get all versions of a specific process + - name: search + in: query + schema: + type: string + description: Filter by BPMN process ID or BPMN process name (partial match) responses: 200: description: List of process definitions @@ -346,25 +702,37 @@ paths: $ref: "#/components/schemas/ProcessDefinitionsPage" example: items: - - key: "4503599627370498" + - key: 4503599627370498 version: 1 bpmnProcessId: "loan-application" - - key: "4503599627370499" + - key: 4503599627370499 version: 2 bpmnProcessId: "loan-application" - - key: "4503599627370500" + - key: 4503599627370500 version: 1 bpmnProcessId: "credit-check" page: 1 size: 10 - count: 3 - totalCount: 3 + count: 2 + totalCount: 2 + 400: + description: Bad request + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + code: "BAD_REQUEST" + message: "The request parameters are invalid" 500: description: Internal server error content: application/json: schema: $ref: "#/components/schemas/Error" + example: + code: "INTERNAL_SERVER_ERROR" + message: "An unexpected error occurred while retrieving process definitions" /process-definitions/{processDefinitionKey}: get: @@ -388,7 +756,7 @@ paths: schema: $ref: "#/components/schemas/ProcessDefinitionDetail" example: - key: "4503599627370498" + key: 4503599627370498 version: 1 bpmnProcessId: "loan-application" bpmnData: | @@ -404,12 +772,228 @@ paths: application/json: schema: $ref: "#/components/schemas/Error" + example: + code: "BAD_REQUEST" + message: "The provided processDefinitionKey is invalid" + 404: + description: Not Found + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + code: "NOT_FOUND" + message: "No process definition found for the given key" 500: description: Internal server error content: application/json: schema: $ref: "#/components/schemas/Error" + example: + code: "INTERNAL_SERVER_ERROR" + message: "An unexpected error occurred while retrieving the process definition" + + /process-definitions/{processDefinitionKey}/statistics: + get: + operationId: getProcessDefinitionElementStatistics + summary: Get running and incident counts per BPMN element + tags: + - process-definition + parameters: + - name: processDefinitionKey + required: true + in: path + schema: + type: integer + format: int64 + example: 4503599627370498 + responses: + 200: + description: Element statistics as a map of elementId to counts + content: + application/json: + schema: + $ref: "#/components/schemas/ElementStatisticsPartitions" + example: + partitions: + - partition: 1 + items: + Task_CheckApplication: + activeCount: 5 + incidentCount: 2 + Task_CreditCheck: + activeCount: 3 + incidentCount: 1 + - partition: 2 + items: + Task_CheckApplication: + activeCount: 4 + incidentCount: 0 + Task_CreditCheck: + activeCount: 6 + incidentCount: 3 + 400: + description: Bad request + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + code: "BAD_REQUEST" + message: "The provided processDefinitionKey is invalid" + 404: + description: Not Found + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + code: "NOT_FOUND" + message: "No process definition found for the given key" + 500: + description: Internal server error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + code: "INTERNAL_SERVER_ERROR" + message: "An unexpected error occurred while retrieving process definition statistics" + 502: + description: Failed to redirect request to responsible node + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + code: "BAD_GATEWAY" + message: "Failed to redirect request to responsible node" + + /process-definitions/statistics: + get: + operationId: getProcessDefinitionStatistics + summary: Get process definition statistics + tags: + - process-definition + parameters: + - name: page + in: query + schema: + type: integer + format: int32 + minimum: 1 + default: 1 + description: Page number (1-based indexing) + - name: size + in: query + schema: + type: integer + format: int32 + minimum: 1 + maximum: 100 + default: 10 + description: Number of items per page (max 100) + - name: onlyLatest + in: query + schema: + type: boolean + default: false + description: If true, returns only the latest version of each process definition + - name: bpmnProcessIdIn + in: query + schema: + type: array + items: + type: string + description: Filter by BPMN process ID + - name: bpmnProcessDefinitionKeyIn + in: query + schema: + type: array + items: + type: integer + format: int64 + description: Filter by process definition key + - name: search + in: query + schema: + type: string + description: Search by BPMN process ID or BPMN process name (partial match) + - name: sortBy + in: query + schema: + type: string + enum: [name, bpmnProcessId, version, instanceCount, incidentCount] + description: Sort field + - name: sortOrder + in: query + schema: + type: string + enum: [asc, desc] + description: Sort direction + responses: + 200: + description: Process definition statistics + content: + application/json: + schema: + $ref: "#/components/schemas/ProcessDefinitionStatisticsPage" + example: + items: + - key: 4503599627370498 + version: 3 + bpmnProcessId: "loan-application" + name: "Loan Application Process" + bpmnResourceName: "loan-application.bpmn" + instanceCounts: + total: 1250 + active: 45 + completed: 1180 + terminated: 20 + failed: 5 + - key: 4503599627370510 + version: 1 + bpmnProcessId: "order-fulfillment" + name: "Order Fulfillment" + bpmnResourceName: "order-fulfillment.bpmn" + instanceCounts: + total: 890 + active: 120 + completed: 750 + terminated: 15 + failed: 5 + page: 1 + size: 10 + count: 2 + totalCount: 2 + 400: + description: Bad request + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + code: "BAD_REQUEST" + message: "The request parameters are invalid" + 500: + description: Internal server error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + code: "INTERNAL_SERVER_ERROR" + message: "An unexpected error occurred while retrieving process definition statistics" + 502: + description: Failed to redirect request to responsible node + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + code: "BAD_GATEWAY" + message: "Failed to redirect request to responsible node" /process-instances: post: @@ -423,12 +1007,14 @@ paths: application/json: schema: type: object - required: - - processDefinitionKey properties: processDefinitionKey: type: integer format: int64 + description: Start the process instance using bpmn process definition identified by processDefinitionKey. ( Takes priority ) + bpmnProcessId: + type: string + description: Start the process instance using latest bpmn process definition identified by bpmnProcessId. variables: type: object historyTimeToLive: @@ -438,12 +1024,12 @@ paths: businessKey: type: string description: Business key of the process instance used mainly for correlating process instance to the business entity. - example: - processDefinitionKey: 4503599627370498 - variables: - customerId: "customer-456" - amount: 1000 - applicationDate: "2025-08-22" + example: + processDefinitionKey: 4503599627370498 + variables: + customerId: "customer-456" + amount: 1000 + applicationDate: "2025-08-22" responses: 201: description: Process instance created @@ -452,8 +1038,8 @@ paths: schema: $ref: "#/components/schemas/ProcessInstance" example: - key: "4503599627370501" - processDefinitionKey: "4503599627370498" + key: 4503599627370501 + processDefinitionKey: 4503599627370498 createdAt: "2025-08-22T14:30:25Z" state: "active" variables: @@ -466,6 +1052,12 @@ paths: application/json: schema: $ref: "#/components/schemas/Error" + 404: + description: Not found (e.g. process definition was not found) + content: + application/json: + schema: + $ref: "#/components/schemas/Error" 500: description: Internal server error content: @@ -521,7 +1113,45 @@ paths: default: 10 description: Number of items per page example: 10 - + - name: bpmnProcessId + in: query + schema: + type: string + description: Filter by BPMN process ID (returns instances across all versions) + - name: sortBy + in: query + schema: + type: string + enum: [createdAt, key, state, businessKey, bpmnProcessId] + description: Sort field (applies globally across partitions) + - $ref: "#/components/parameters/sortOrder" + - name: createdFrom + in: query + schema: + type: string + format: date-time + description: Filter - created after this date + - name: createdTo + in: query + schema: + type: string + format: date-time + description: Filter - created before this date + - name: state + in: query + schema: + type: string + enum: [active, completed, terminated, failed] + description: Filter by state + - name: activityId + in: query + schema: + type: string + description: Filter by current activity element ID + - name: includeChildProcesses + in: query + schema: + type: boolean responses: 200: description: List of running process instances @@ -532,17 +1162,20 @@ paths: example: partitions: - partition: 1 + count: 24 items: - - key: "4503599627370501" - processDefinitionKey: "4503599627370498" + - key: 4503599627370501 + processDefinitionKey: 4503599627370498 + bpmnProcessId: "loan-application" createdAt: "2025-08-22T14:30:25Z" state: "active" variables: customerId: "customer-456" amount: 1000 applicationDate: "2025-08-22" - - key: "4503599627370505" - processDefinitionKey: "4503599627370498" + - key: 4503599627370505 + processDefinitionKey: 4503599627370498 + bpmnProcessId: "loan-application" createdAt: "2025-08-22T15:10:12Z" state: "active" variables: @@ -550,9 +1183,11 @@ paths: amount: 5000 applicationDate: "2025-08-22" - partition: 2 + count: 18 items: - - key: "9007199254740992" - processDefinitionKey: "4503599627370498" + - key: 9007199254740992 + processDefinitionKey: 4503599627370498 + bpmnProcessId: "loan-application" createdAt: "2025-08-22T15:45:33Z" state: "active" variables: @@ -562,7 +1197,7 @@ paths: page: 1 size: 10 count: 3 - totalCount: 3 + totalCount: 42 400: description: Bad request content: @@ -587,7 +1222,283 @@ paths: operationId: getProcessInstance tags: - process-instance - summary: Get state of a process instance selected by processInstanceKey + summary: Get state of a process instance selected by processInstanceKey + parameters: + - name: processInstanceKey + in: path + required: true + schema: + type: integer + format: int64 + example: 4503599627370501 + responses: + 200: + description: State of a process instance + content: + application/json: + schema: + $ref: "#/components/schemas/ProcessInstance" + example: + key: 4503599627370501 + processDefinitionKey: 4503599627370498 + createdAt: "2025-08-22T14:30:25Z" + state: "active" + variables: + customerId: "customer-456" + amount: 1000 + applicationDate: "2025-08-22" + taskAssignee: "john.doe" + currentStatus: "Application review" + + 404: + description: Not Found + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + 500: + description: Internal server error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + 502: + description: Failed to collect data from responsible node + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + + /process-instances/{processInstanceKey}/variables: + patch: + operationId: updateProcessInstanceVariables + summary: Update process instance variables + tags: + - process-instance + parameters: + - name: processInstanceKey + in: path + required: true + schema: + type: integer + format: int64 + example: 4503599627370501 + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - variables + properties: + variables: + type: object + example: + variables: + orderAmount: 150.00 + approved: true + reviewedBy: "john.doe" + reviewComment: "Approved after verification" + responses: + 204: + description: Variables updated + 400: + description: Bad request + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + 404: + description: Not found (e.g process instance is not found) + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + 409: + description: Conflict (e.g process instance is not in correct state for this operation) + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + 500: + description: Internal server error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + 502: + description: Failed to redirect request to responsible node + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + + /process-instances/{processInstanceKey}/variables/{variableName}: + delete: + operationId: deleteProcessInstanceVariable + summary: Delete a process instance variable + tags: + - process-instance + parameters: + - name: processInstanceKey + in: path + required: true + schema: + type: integer + format: int64 + example: 4503599627370501 + - name: variableName + in: path + required: true + schema: + type: string + example: "temporaryFlag" + responses: + 204: + description: Variable deleted + 400: + description: Bad request + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + 404: + description: Not found (e.g. process instance or variable not found) + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + 409: + description: Conflict (e.g process instance is not in correct state for this operation) + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + 500: + description: Internal server error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + 502: + description: Failed to redirect request to responsible node + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + + /process-instances/{processInstanceKey}/child-processes: + get: + summary: Get list of running child process instances + operationId: getChildProcessInstances + tags: + - process-instance + parameters: + - name: processInstanceKey + in: path + required: true + schema: + type: integer + format: int64 + example: 4503599627370501 + - name: page + in: query + schema: + type: integer + format: int32 + minimum: 1 + default: 1 + description: Page number (1-based indexing) + example: 1 + - name: size + in: query + schema: + type: integer + format: int32 + minimum: 1 + default: 10 + description: Number of items per page + example: 10 + - name: sortBy + in: query + schema: + type: string + enum: [key, state] + description: Sort field (applies globally across partitions) + - $ref: "#/components/parameters/sortOrder" + - name: state + in: query + schema: + type: string + enum: [active, completed, terminated, failed] + description: Filter by state + responses: + 200: + description: List of child process instances + content: + application/json: + schema: + $ref: "#/components/schemas/ProcessInstancePage" + example: + partitions: + - partition: 1 + items: + - key: 4503599627370501 + processDefinitionKey: 4503599627370498 + createdAt: "2025-08-22T14:30:25Z" + state: "active" + variables: + customerId: "customer-456" + amount: 1000 + applicationDate: "2025-08-22" + - key: 4503599627370505 + processDefinitionKey: 4503599627370498 + createdAt: "2025-08-22T15:10:12Z" + state: "active" + variables: + customerId: "customer-789" + amount: 5000 + applicationDate: "2025-08-22" + - partition: 2 + items: + - key: 9007199254740992 + processDefinitionKey: 4503599627370498 + createdAt: "2025-08-22T15:45:33Z" + state: "active" + variables: + customerId: "customer-101" + amount: 7500 + applicationDate: "2025-08-22" + page: 1 + size: 10 + count: 3 + totalCount: 3 + 400: + description: Bad request + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + 500: + description: Internal server error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + 502: + description: Failed to collect data from responsible nodes + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + + /process-instances/{processInstanceKey}/cancel: + post: + operationId: cancelProcessInstance + summary: Cancels a process instance + tags: + - process-instance parameters: - name: processInstanceKey in: path @@ -597,38 +1508,34 @@ paths: format: int64 example: 4503599627370501 responses: - 200: - description: State of a process instance + 204: + description: Process instance cancelled + 400: + description: Bad request content: application/json: schema: - $ref: "#/components/schemas/ProcessInstance" - example: - key: "4503599627370501" - processDefinitionKey: "4503599627370498" - createdAt: "2025-08-22T14:30:25Z" - state: "active" - variables: - customerId: "customer-456" - amount: 1000 - applicationDate: "2025-08-22" - taskAssignee: "john.doe" - currentStatus: "Application review" - - 400: - description: Bad request + $ref: "#/components/schemas/Error" + 404: + description: Not found (e.g. process instance is not found) content: application/json: schema: $ref: "#/components/schemas/Error" - 500: - description: Internal server error + 409: + description: Conflict (e.g process instance is not in cancellable state) content: application/json: schema: $ref: "#/components/schemas/Error" 502: - description: Failed to collect data from responsible node + description: Failed to redirect request to responsible node + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + 500: + description: Internal server error content: application/json: schema: @@ -676,19 +1583,19 @@ paths: $ref: "#/components/schemas/JobPage" example: items: - - key: "4503599627370510" + - key: 4503599627370510 elementId: "Task_CheckApplication" type: "user-task" - processInstanceKey: "4503599627370501" + processInstanceKey: 4503599627370501 state: "active" createdAt: "2025-08-22T14:30:26Z" variables: formKey: "loan-application-form" assignee: "john.doe" - - key: "4503599627370511" + - key: 4503599627370511 elementId: "Task_CreditCheck" type: "service-task" - processInstanceKey: "4503599627370501" + processInstanceKey: 4503599627370501 state: "completed" createdAt: "2025-08-22T14:32:15Z" variables: @@ -750,6 +1657,17 @@ paths: default: 10 description: Number of items per page (max 100) example: 10 + - name: sortBy + in: query + schema: + type: string + enum: [createdAt] + - name: sortOrder + in: query + schema: + type: string + enum: [asc, desc] + description: Sort direction responses: 200: description: List of activities @@ -759,17 +1677,17 @@ paths: $ref: "#/components/schemas/FlowElementHistoryPage" example: items: - - key: "4503599627370525" + - key: 4503599627370525 elementId: "StartEvent_1" - processInstanceKey: "4503599627370501" + processInstanceKey: 4503599627370501 createdAt: "2025-08-22T14:30:26Z" - - key: "4503599627370526" + - key: 4503599627370526 elementId: "Flow_1" - processInstanceKey: "4503599627370501" + processInstanceKey: 4503599627370501 createdAt: "2025-08-22T14:30:26Z" - - key: "4503599627370527" + - key: 4503599627370527 elementId: "Task_CheckApplication" - processInstanceKey: "4503599627370501" + processInstanceKey: 4503599627370501 createdAt: "2025-08-22T14:30:27Z" page: 1 size: 10 @@ -781,6 +1699,12 @@ paths: application/json: schema: $ref: "#/components/schemas/Error" + 500: + description: Internal server error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" 502: description: Failed to collect data from responsible node content: @@ -802,6 +1726,12 @@ paths: type: integer format: int64 example: 4503599627370501 + - name: state + in: query + schema: + type: string + enum: [resolved, unresolved] + description: Filter by incident state (omit to get all incidents) - name: page in: query schema: @@ -830,21 +1760,25 @@ paths: $ref: "#/components/schemas/IncidentPage" example: items: - - key: "4503599627370530" - elementInstanceKey: "4503599627370521" + - key: 4503599627370530 + elementInstanceKey: 4503599627370521 elementId: "Task_CheckApplication" - processInstanceKey: "4503599627370501" + processInstanceKey: 4503599627370501 message: "Failed to assign task: User not found" createdAt: "2025-08-22T14:35:10Z" - executionToken: "123456" - - key: "4503599627370531" - elementInstanceKey: "4503599627370522" + executionToken: 123456 + bpmnProcessId: "loan-application" + state: "unresolved" + - key: 4503599627370531 + elementInstanceKey: 4503599627370522 elementId: "Task_CreditCheck" - processInstanceKey: "4503599627370501" + processInstanceKey: 4503599627370501 message: "External service unavailable" createdAt: "2025-08-22T14:36:22Z" resolvedAt: "2025-08-22T14:45:18Z" - executionToken: "123457" + executionToken: 123457 + bpmnProcessId: "loan-application" + state: "resolved" page: 1 size: 10 count: 2 @@ -855,6 +1789,230 @@ paths: application/json: schema: $ref: "#/components/schemas/Error" + 500: + description: Internal server error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + 502: + description: Failed to collect data from responsible node + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + + /process-instances/{processInstanceKey}/event-subscriptions/messages: + get: + operationId: getProcessInstanceMessageSubscriptions + tags: + - process-instance + summary: Get message event subscriptions for a process instance + parameters: + - name: processInstanceKey + in: path + required: true + schema: + type: integer + format: int64 + - name: page + in: query + schema: + type: integer + format: int32 + - name: size + in: query + schema: + type: integer + format: int32 + - name: state + in: query + schema: + $ref: "#/components/schemas/EventSubscriptionState" + responses: + 200: + description: List of message subscriptions + content: + application/json: + schema: + $ref: "#/components/schemas/MessageSubscriptionPage" + 400: + description: Bad request + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + 500: + description: Internal server error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + 502: + description: Cluster error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + + /process-instances/{processInstanceKey}/event-subscriptions/timers: + get: + operationId: getProcessInstanceTimerSubscriptions + tags: + - process-instance + summary: Get timer event subscriptions for a process instance + parameters: + - name: processInstanceKey + in: path + required: true + schema: + type: integer + format: int64 + - name: page + in: query + schema: + type: integer + format: int32 + - name: size + in: query + schema: + type: integer + format: int32 + - name: state + in: query + schema: + $ref: "#/components/schemas/EventSubscriptionState" + responses: + 200: + description: List of timer subscriptions + content: + application/json: + schema: + $ref: "#/components/schemas/TimerSubscriptionPage" + 400: + description: Bad request + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + 500: + description: Internal server error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + 502: + description: Cluster error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + + /process-instances/{processInstanceKey}/event-subscriptions/errors: + get: + operationId: getProcessInstanceErrorSubscriptions + tags: + - process-instance + summary: Get error event subscriptions for a process instance + parameters: + - name: processInstanceKey + in: path + required: true + schema: + type: integer + format: int64 + - name: page + in: query + schema: + type: integer + format: int32 + - name: size + in: query + schema: + type: integer + format: int32 + - name: state + in: query + schema: + $ref: "#/components/schemas/EventSubscriptionState" + responses: + 200: + description: List of error subscriptions + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorSubscriptionPage" + 400: + description: Bad request + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + 500: + description: Internal server error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + 502: + description: Cluster error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + + /process-instances/{processInstanceKey}/statistics: + get: + operationId: getProcessInstanceElementStatistics + summary: Get running and incident counts per BPMN element for a process instance + tags: + - process-instance + parameters: + - name: processInstanceKey + required: true + in: path + schema: + type: integer + format: int64 + example: 4503599627370501 + responses: + 200: + description: Element statistics as a map of elementId to counts + content: + application/json: + schema: + $ref: "#/components/schemas/ElementStatisticsPartitions" + example: + partitions: + - partition: 1 + items: + Task_CheckApplication: + activeCount: 1 + incidentCount: 0 + 400: + description: Bad request + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + code: "BAD_REQUEST" + message: "The provided processInstanceKey is invalid" + 404: + description: Not Found + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + code: "NOT_FOUND" + message: "No process instance found for the given key" + 500: + description: Internal server error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" 502: description: Failed to collect data from responsible node content: @@ -869,32 +2027,62 @@ paths: - job summary: Get list of jobs on partitions parameters: + - name: processInstanceKey + in: query + schema: + type: integer + format: int64 + description: Filter by process instance - name: jobType in: query required: false schema: type: string + description: Filter by job type example: "service-task" + - name: assignee + in: query + schema: + type: string + description: Filter by assignee - name: state in: query required: false schema: $ref: "#/components/schemas/JobState" + description: Filter by job state example: "active" - name: page in: query schema: type: integer format: int32 + minimum: 1 default: 1 + description: Page number (1-based indexing) example: 1 - name: size in: query schema: type: integer format: int32 + minimum: 1 + maximum: 100 default: 10 + description: Number of items per page (max 100) example: 10 + - name: sortBy + in: query + schema: + type: string + enum: [createdAt, key, type, state] + description: Sort field + - name: sortOrder + in: query + schema: + type: string + enum: [asc, desc] + description: Sort direction responses: 200: description: List of jobs on partitions @@ -906,25 +2094,25 @@ paths: partitions: - partition: 1 items: - - key: "4503599627370540" - elementId: "Task_ProcessPayment" - type: "service-task" - processInstanceKey: "4503599627370501" + - key: 4503599627370540 + elementId: "Task_ReviewApplication" + type: "user-task" + processInstanceKey: 4503599627370501 state: "active" createdAt: "2025-08-22T15:10:26Z" + assignee: "john.doe" + retries: 3 variables: - paymentDetails: - amount: 1000 - currency: "USD" - method: "credit-card" + formKey: "loan-review-form" - partition: 2 items: - - key: "9007199254740995" + - key: 9007199254740995 elementId: "Task_SendNotification" type: "service-task" - processInstanceKey: "9007199254740992" + processInstanceKey: 9007199254740992 state: "active" createdAt: "2025-08-22T15:46:33Z" + retries: 3 variables: notificationType: "email" recipient: "customer@example.com" @@ -932,6 +2120,65 @@ paths: size: 10 count: 2 totalCount: 2 + 400: + description: Bad request + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + 500: + description: Internal server error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + 502: + description: Failed to collect data from responsible node + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + + /jobs/{jobKey}: + get: + operationId: getJob + summary: Get job details + tags: + - job + parameters: + - name: jobKey + in: path + required: true + schema: + type: integer + format: int64 + example: 4503599627370540 + responses: + 200: + description: Job details + content: + application/json: + schema: + $ref: "#/components/schemas/Job" + example: + key: 4503599627370540 + elementId: "Task_ReviewApplication" + type: "zenbpm:userTask" + processInstanceKey: 4503599627370501 + state: "active" + createdAt: "2025-08-22T15:10:26Z" + assignee: "john.doe" + retries: 3 + variables: + formKey: "loan-review-form" + applicationId: "APP-12345" + customerName: "Alice Johnson" + 404: + description: Not found + content: + application/json: + schema: + $ref: "#/components/schemas/Error" 500: description: Internal server error content: @@ -944,27 +2191,86 @@ paths: application/json: schema: $ref: "#/components/schemas/Error" + + /jobs/{jobKey}/assign: + post: + operationId: assignJob + summary: Assign a job to a user + tags: + - job + parameters: + - name: jobKey + in: path + required: true + schema: + type: integer + format: int64 + example: 4503599627370540 + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - assignee + properties: + assignee: + type: string + example: + assignee: "john.doe" + responses: + 204: + description: Job assigned + 400: + description: Bad request + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + 404: + description: Job not found + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + 500: + description: Internal server error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + 502: + description: Failed to redirect request to responsible node + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + + /jobs/{jobKey}/complete: post: operationId: completeJob tags: - job summary: Complete a job + parameters: + - name: jobKey + in: path + required: true + schema: + type: integer + format: int64 + example: 4503599627370540 requestBody: required: true content: application/json: schema: type: object - required: - - jobKey properties: - jobKey: - type: integer - format: int64 variables: type: object example: - jobKey: 4503599627370540 variables: result: "success" transactionId: "tx-789-xyz" @@ -978,6 +2284,76 @@ paths: application/json: schema: $ref: "#/components/schemas/Error" + 404: + description: Not found + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + 500: + description: Internal server error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + 502: + description: Failed to redirect request to responsible node + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + + /jobs/{jobKey}/fail: + post: + operationId: failJob + tags: + - job + summary: Fail a job + parameters: + - name: jobKey + in: path + required: true + description: The key of the job to fail. + schema: + type: integer + format: int64 + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + errorCode: + type: string + description: The error code against which an error catch event is matched. + variables: + type: object + example: + errorCode: "123-456-789" + variables: + transactionId: "tx-789-xyz" + responses: + 204: + description: The job is failed. + 400: + description: Bad request + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + 404: + description: Not found + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + 500: + description: Internal server error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" 502: description: Failed to redirect request to responsible node content: @@ -998,7 +2374,6 @@ paths: schema: type: object required: - - correlationKey - messageName properties: correlationKey: @@ -1024,12 +2399,36 @@ paths: application/json: schema: $ref: "#/components/schemas/Error" + example: + code: "BAD_REQUEST" + message: "Invalid request payload" + 404: + description: Not found + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + code: "NOT_FOUND" + message: "The requested resource was not found" + 500: + description: Internal server error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + code: "TECHNICAL_ERROR" + message: "An unexpected error occurred while processing the request" 502: description: Failed to redirect request to responsible node content: application/json: schema: $ref: "#/components/schemas/Error" + example: + code: "CLUSTER_ERROR" + message: "Failed to redirect request to responsible node" /incidents/{incidentKey}/resolve: post: @@ -1054,6 +2453,18 @@ paths: application/json: schema: $ref: "#/components/schemas/Error" + 404: + description: Not found + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + 500: + description: Internal server error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" 502: description: Failed to redirect request to responsible node content: @@ -1085,7 +2496,7 @@ paths: type: object startingElementIds: type: array - description: "Allows for a start at chosen element id" + description: Allows for a start at chosen element id items: type: string example: @@ -1108,6 +2519,12 @@ paths: application/json: schema: $ref: "#/components/schemas/Error" + 404: + description: Not found (e.g. process definition with processDefinitionKey not found) + content: + application/json: + schema: + $ref: "#/components/schemas/Error" 500: description: Internal server error content: @@ -1142,17 +2559,17 @@ paths: format: int64 variables: type: object - description: "Sets process instance variables." + description: Sets process instance variables. elementInstancesToStart: type: array items: $ref: "#/components/schemas/StartElementInstanceData" - description: "Starts execution token." + description: Starts execution token. elementInstancesToTerminate: type: array items: $ref: "#/components/schemas/TerminateElementInstanceData" - description: "Terminates execution token." + description: Terminates execution token. responses: 201: description: Process instance modified @@ -1173,6 +2590,12 @@ paths: application/json: schema: $ref: "#/components/schemas/Error" + 404: + description: Not found + content: + application/json: + schema: + $ref: "#/components/schemas/Error" 500: description: Internal server error content: @@ -1186,10 +2609,10 @@ paths: schema: $ref: "#/components/schemas/Error" - /tests/{nodeId}/start-cpu-profile: + /tests/{nodeId}/start-pprof-server: post: - operationId: testStartCpuProfile - summary: start a cpu profiler + operationId: testStartPprofServer + summary: start pprof server tags: - test parameters: @@ -1199,20 +2622,21 @@ paths: schema: type: string pattern: "^[a-zA-Z0-9-_]+$" - description: ID of the node to profile + description: ID of the node to start pprof server on responses: 200: - description: Cpu profiler starter + description: Pprof server started 500: description: Internal server error content: application/json: schema: $ref: "#/components/schemas/Error" - /tests/{nodeId}/stop-cpu-profile: + + /tests/{nodeId}/stop-pprof-server: post: - operationId: testStopCpuProfile - summary: stop a cpu profiler + operationId: testStopPprofServer + summary: stop pprof server tags: - test parameters: @@ -1222,18 +2646,10 @@ paths: schema: type: string pattern: "^[a-zA-Z0-9-_]+$" - description: ID of the node to stop profiling + description: ID of the node to stop pprof server on responses: 200: - description: Cpu profiler stopped - content: - application/json: - schema: - type: object - properties: - pprof: - type: string - format: byte + description: Pprof server stopped 500: description: Internal server error content: @@ -1243,6 +2659,146 @@ paths: components: schemas: + DecisionInstancePartitionPage: + type: object + allOf: + - type: object + required: + - partitions + properties: + partitions: + type: array + items: + $ref: "#/components/schemas/PartitionDecisionInstances" + - $ref: "#/components/schemas/PartitionedPageMetadata" + PartitionDecisionInstances: + type: object + required: + - partition + - items + properties: + partition: + type: integer + count: + type: integer + description: Total decision instances in this partition + items: + type: array + items: + $ref: "#/components/schemas/DecisionInstanceSummary" + DecisionInstanceSummary: + type: object + required: + - key + - dmnResourceDefinitionKey + - evaluatedAt + properties: + key: + type: integer + format: int64 + dmnResourceDefinitionKey: + type: integer + format: int64 + processInstanceKey: + type: integer + format: int64 + flowElementInstanceKey: + type: integer + format: int64 + description: Key of the flow element instance that triggered this decision + evaluatedAt: + type: string + format: date-time + DecisionInstanceDetail: + type: object + required: + - key + - dmnResourceDefinitionKey + - evaluatedAt + - evaluatedDecisions + properties: + key: + type: integer + format: int64 + dmnResourceDefinitionKey: + type: integer + format: int64 + processInstanceKey: + type: integer + format: int64 + flowElementInstanceKey: + type: integer + format: int64 + description: Key of the flow element instance that triggered this decision + evaluatedAt: + type: string + format: date-time + evaluatedDecisions: + type: array + items: + $ref: "#/components/schemas/EvaluatedDecision" + decisionOutput: + type: string + format: json + x-go-type: json.RawMessage + description: Final output of the requested decision + EvaluatedDecision: + type: object + properties: + decisionId: + type: string + decisionName: + type: string + decisionType: + type: string + enum: [DECISION_TABLE, LITERAL_EXPRESSION] + evaluationOrder: + type: integer + description: Order in which this decision was evaluated + inputs: + type: array + items: + $ref: "#/components/schemas/EvaluatedInput" + outputs: + type: array + items: + $ref: "#/components/schemas/EvaluatedOutput" + matchedRules: + type: array + items: + $ref: "#/components/schemas/MatchedRule" + description: For DECISION_TABLE type only + EvaluatedInput: + type: object + properties: + inputId: + type: string + inputName: + type: string + inputExpression: + type: string + inputValue: + description: The evaluated input value (any type) + EvaluatedOutput: + type: object + properties: + outputId: + type: string + outputName: + type: string + outputValue: + description: The output value (any type) + MatchedRule: + type: object + properties: + ruleId: + type: string + ruleIndex: + type: integer + evaluatedOutputs: + type: array + items: + $ref: "#/components/schemas/EvaluatedOutput" PartitionedPageMetadata: type: object required: @@ -1294,7 +2850,7 @@ components: items: type: array items: - $ref: "#/components/schemas/ProcessInstance" + $ref: "#/components/schemas/ProcessInstancesSimple" DmnResourceDefinitionsPage: type: object allOf: @@ -1312,8 +2868,8 @@ components: required: - key - version - - decisionDefinitionId - - resourceName + - dmnResourceDefinitionId + - dmnDefinitionName properties: key: type: integer @@ -1322,7 +2878,7 @@ components: type: integer dmnResourceDefinitionId: type: string - resourceName: + dmnDefinitionName: type: string DmnResourceDefinitionDetail: type: object @@ -1337,9 +2893,13 @@ components: EvaluatedDRDResult: type: object required: + - decisionInstanceKey - evaluatedDecisions - decisionOutput properties: + decisionInstanceKey: + type: integer + format: int64 evaluatedDecisions: type: array items: @@ -1353,7 +2913,7 @@ components: - decisionType - decisionDefinitionVersion - dmnResourceDefinitionKey - - decisionDefinitionId + - dmnResourceDefinitionId - matchedRules - decisionOutput - evaluatedInputs @@ -1369,7 +2929,7 @@ components: dmnResourceDefinitionKey: type: integer format: int64 - decisionDefinitionId: + dmnResourceDefinitionId: type: string matchedRules: type: array @@ -1450,6 +3010,9 @@ components: type: integer bpmnProcessId: type: string + bpmnProcessName: + type: string + description: Process name from BPMN ProcessDefinitionDetail: type: object required: @@ -1460,6 +3023,128 @@ components: properties: bpmnData: type: string + ElementStatisticCounts: + type: object + description: Active and incident counts for a single BPMN element + required: + - activeCount + - incidentCount + properties: + activeCount: + type: integer + description: Number of active element instances + incidentCount: + type: integer + description: Number of incidents on this element + completedCount: + type: integer + description: Number of completed element instances + terminatedCount: + type: integer + description: Number of terminated (canceled) element instances + ElementStatistic: + type: object + description: Map of elementId to active/incident counts + additionalProperties: + $ref: "#/components/schemas/ElementStatisticCounts" + PartitionElementStatistics: + type: object + required: + - partition + - items + properties: + partition: + type: integer + items: + $ref: "#/components/schemas/ElementStatistic" + ElementStatisticsPartitions: + type: object + required: + - partitions + properties: + partitions: + type: array + items: + $ref: "#/components/schemas/PartitionElementStatistics" + ProcessDefinitionStatisticsPage: + type: object + required: + - partitions + - page + - size + - count + - totalCount + properties: + partitions: + type: array + items: + $ref: "#/components/schemas/PartitionProcessDefinitionStatistics" + page: + type: integer + size: + type: integer + count: + type: integer + description: Number of items in current page + totalCount: + type: integer + description: Total number of items across all pages + PartitionProcessDefinitionStatistics: + type: object + required: + - partition + - items + properties: + partition: + type: integer + items: + type: array + items: + $ref: "#/components/schemas/ProcessDefinitionStatistics" + ProcessDefinitionStatistics: + type: object + required: + - key + - version + - bpmnProcessId + - instanceCounts + properties: + key: + type: integer + format: int64 + version: + type: integer + bpmnProcessId: + type: string + name: + type: string + description: Process name from BPMN + instanceCounts: + $ref: "#/components/schemas/InstanceCounts" + InstanceCounts: + type: object + required: + - total + - active + - completed + - terminated + - failed + properties: + total: + type: integer + description: Total number of process instances + active: + type: integer + description: Number of active instances + completed: + type: integer + description: Number of completed instances + terminated: + type: integer + description: Number of terminated instances + failed: + type: integer + description: Number of failed instances ProcessInstancePage: type: object allOf: @@ -1473,6 +3158,17 @@ components: $ref: "#/components/schemas/PartitionProcessInstances" - $ref: "#/components/schemas/PartitionedPageMetadata" ProcessInstance: + allOf: + - $ref: "#/components/schemas/ProcessInstancesSimple" + - type: object + required: + - activeElementInstances + properties: + activeElementInstances: + type: array + items: + $ref: "#/components/schemas/ElementInstance" + ProcessInstancesSimple: type: object required: - key @@ -1480,7 +3176,7 @@ components: - createdAt - state - variables - - activeElementInstances + - processType properties: key: type: integer @@ -1488,26 +3184,180 @@ components: processDefinitionKey: type: integer format: int64 + bpmnProcessId: + type: string businessKey: type: string createdAt: type: string format: date-time state: - type: string - enum: - - active - - completed - - terminated + $ref: "#/components/schemas/ProcessInstanceState" parentProcessInstanceKey: type: integer format: int64 + processType: + $ref: "#/components/schemas/ProcessInstanceProcessType" variables: type: object - activeElementInstances: - type: array - items: - $ref: "#/components/schemas/ElementInstance" + ProcessInstanceProcessType: + type: string + enum: + - default + - multiInstance + - subprocess + - callActivity + ProcessInstanceState: + type: string + enum: + - active + - completed + - terminated + - failed + EventSubscriptionState: + type: string + enum: + - active + - compensated + - compensating + - completed + - completing + - failed + - failing + - ready + - terminated + - terminating + - withdrawn + MessageSubscription: + type: object + required: + - key + - elementId + - processDefinitionKey + - processInstanceKey + - messageName + - state + - createdAt + properties: + key: + type: integer + format: int64 + elementId: + type: string + processDefinitionKey: + type: integer + format: int64 + processInstanceKey: + type: integer + format: int64 + messageName: + type: string + correlationKey: + type: string + nullable: true + state: + $ref: "#/components/schemas/EventSubscriptionState" + createdAt: + type: string + format: date-time + TimerSubscription: + type: object + required: + - key + - elementId + - processDefinitionKey + - processInstanceKey + - state + - createdAt + properties: + key: + type: integer + format: int64 + elementId: + type: string + processDefinitionKey: + type: integer + format: int64 + processInstanceKey: + type: integer + format: int64 + state: + $ref: "#/components/schemas/EventSubscriptionState" + createdAt: + type: string + format: date-time + dueDate: + type: string + format: date-time + ErrorSubscription: + type: object + required: + - key + - elementInstanceKey + - elementId + - processDefinitionKey + - processInstanceKey + - state + - createdAt + properties: + key: + type: integer + format: int64 + elementInstanceKey: + type: integer + format: int64 + elementId: + type: string + processDefinitionKey: + type: integer + format: int64 + processInstanceKey: + type: integer + format: int64 + errorCode: + type: string + nullable: true + state: + $ref: "#/components/schemas/EventSubscriptionState" + createdAt: + type: string + format: date-time + MessageSubscriptionPage: + type: object + allOf: + - type: object + required: + - items + properties: + items: + type: array + items: + $ref: "#/components/schemas/MessageSubscription" + - $ref: "#/components/schemas/PageMetadata" + TimerSubscriptionPage: + type: object + allOf: + - type: object + required: + - items + properties: + items: + type: array + items: + $ref: "#/components/schemas/TimerSubscription" + - $ref: "#/components/schemas/PageMetadata" + ErrorSubscriptionPage: + type: object + allOf: + - type: object + required: + - items + properties: + items: + type: array + items: + $ref: "#/components/schemas/ErrorSubscription" + - $ref: "#/components/schemas/PageMetadata" JobPage: type: object allOf: @@ -1572,6 +3422,12 @@ components: format: date-time variables: type: object + assignee: + type: string + description: Assignee (user assigned to this job) + retries: + type: integer + description: Remaining retries JobState: type: string enum: @@ -1624,7 +3480,7 @@ components: properties: elementId: type: string - description: "Element instance is created at this element." + description: Element instance is created at this element. example: elementId: "flow-node-1" FlowElementHistory: @@ -1704,3 +3560,11 @@ components: example: code: "NOT_FOUND" message: "Process instance with key 4503599627370501 not found" + parameters: + sortOrder: + name: sortOrder + in: query + schema: + type: string + enum: [asc, desc] + description: Sort direction diff --git a/zenbpm-client-core/src/main/resources/proto/zenbpm.proto b/zenbpm-client-core/src/main/resources/proto/zenbpm.proto index 7d4fd5e..010cdec 100644 --- a/zenbpm-client-core/src/main/resources/proto/zenbpm.proto +++ b/zenbpm-client-core/src/main/resources/proto/zenbpm.proto @@ -1,7 +1,7 @@ edition = "2023"; package grpc; -option java_package = "org.zenbpm.proto"; +option java_package = "org.pbinitiative.zenbpm.proto"; option go_package = "github.com/pbinitiative/zenbpm/internal/grpc/proto"; diff --git a/zenbpm-spring-boot-starter/pom.xml b/zenbpm-spring-boot-starter/pom.xml index 6db6438..1abf337 100644 --- a/zenbpm-spring-boot-starter/pom.xml +++ b/zenbpm-spring-boot-starter/pom.xml @@ -4,13 +4,37 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.zenbpm + org.pbinitiative.zenbpm zenbpm-java-client - v0.3.9 + 1.3.0 zenbpm-spring-boot-starter + ZenBPM Java Client - Spring Boot Starter + Spring Boot starter for the ZenBPM process engine Java client. + https://github.com/pbinitiative/zenbpm-java-client + + + + MIT License + https://opensource.org/licenses/MIT + + + + + + pbinitiative + https://github.com/pbinitiative + + + + + scm:git:https://github.com/pbinitiative/zenbpm-java-client.git + scm:git:https://github.com/pbinitiative/zenbpm-java-client.git + https://github.com/pbinitiative/zenbpm-java-client + + 2.7.18 ${java.version} @@ -38,7 +62,7 @@ true - org.zenbpm + org.pbinitiative.zenbpm zenbpm-client-core ${project.parent.version} diff --git a/zenbpm-spring-boot-starter/src/main/java/org/zenbpm/ZenbpmClientAutoConfiguration.java b/zenbpm-spring-boot-starter/src/main/java/org/pbinitiative/zenbpm/ZenbpmClientAutoConfiguration.java similarity index 88% rename from zenbpm-spring-boot-starter/src/main/java/org/zenbpm/ZenbpmClientAutoConfiguration.java rename to zenbpm-spring-boot-starter/src/main/java/org/pbinitiative/zenbpm/ZenbpmClientAutoConfiguration.java index e118867..04d2094 100644 --- a/zenbpm-spring-boot-starter/src/main/java/org/zenbpm/ZenbpmClientAutoConfiguration.java +++ b/zenbpm-spring-boot-starter/src/main/java/org/pbinitiative/zenbpm/ZenbpmClientAutoConfiguration.java @@ -1,4 +1,4 @@ -package org.zenbpm; +package org.pbinitiative.zenbpm; import io.opentelemetry.api.OpenTelemetry; import org.springframework.beans.factory.ObjectProvider; @@ -6,8 +6,8 @@ import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; -import org.zenbpm.grpc.ZenbpmJobWorkerManager; -import org.zenbpm.rest.ZenbpmClientService; +import org.pbinitiative.zenbpm.grpc.ZenbpmJobWorkerManager; +import org.pbinitiative.zenbpm.rest.ZenbpmClientService; @AutoConfiguration @EnableConfigurationProperties(ZenbpmClientProperties.class) diff --git a/zenbpm-spring-boot-starter/src/main/java/org/zenbpm/ZenbpmClientProperties.java b/zenbpm-spring-boot-starter/src/main/java/org/pbinitiative/zenbpm/ZenbpmClientProperties.java similarity index 98% rename from zenbpm-spring-boot-starter/src/main/java/org/zenbpm/ZenbpmClientProperties.java rename to zenbpm-spring-boot-starter/src/main/java/org/pbinitiative/zenbpm/ZenbpmClientProperties.java index cd280f0..58e6c7f 100644 --- a/zenbpm-spring-boot-starter/src/main/java/org/zenbpm/ZenbpmClientProperties.java +++ b/zenbpm-spring-boot-starter/src/main/java/org/pbinitiative/zenbpm/ZenbpmClientProperties.java @@ -1,4 +1,4 @@ -package org.zenbpm; +package org.pbinitiative.zenbpm; import org.springframework.boot.context.properties.ConfigurationProperties; diff --git a/zenbpm-spring-boot-starter/src/main/java/org/zenbpm/grpc/JobContext.java b/zenbpm-spring-boot-starter/src/main/java/org/pbinitiative/zenbpm/grpc/JobContext.java similarity index 89% rename from zenbpm-spring-boot-starter/src/main/java/org/zenbpm/grpc/JobContext.java rename to zenbpm-spring-boot-starter/src/main/java/org/pbinitiative/zenbpm/grpc/JobContext.java index 0fca4a3..8cd6577 100644 --- a/zenbpm-spring-boot-starter/src/main/java/org/zenbpm/grpc/JobContext.java +++ b/zenbpm-spring-boot-starter/src/main/java/org/pbinitiative/zenbpm/grpc/JobContext.java @@ -1,6 +1,6 @@ -package org.zenbpm.grpc; +package org.pbinitiative.zenbpm.grpc; -import org.zenbpm.proto.Zenbpm; +import org.pbinitiative.zenbpm.proto.Zenbpm; import java.util.Map; diff --git a/zenbpm-spring-boot-starter/src/main/java/org/zenbpm/grpc/JobWorker.java b/zenbpm-spring-boot-starter/src/main/java/org/pbinitiative/zenbpm/grpc/JobWorker.java similarity index 95% rename from zenbpm-spring-boot-starter/src/main/java/org/zenbpm/grpc/JobWorker.java rename to zenbpm-spring-boot-starter/src/main/java/org/pbinitiative/zenbpm/grpc/JobWorker.java index 07334d6..b714d75 100644 --- a/zenbpm-spring-boot-starter/src/main/java/org/zenbpm/grpc/JobWorker.java +++ b/zenbpm-spring-boot-starter/src/main/java/org/pbinitiative/zenbpm/grpc/JobWorker.java @@ -1,4 +1,4 @@ -package org.zenbpm.grpc; +package org.pbinitiative.zenbpm.grpc; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; diff --git a/zenbpm-spring-boot-starter/src/main/java/org/zenbpm/grpc/ZenbpmJobWorkerManager.java b/zenbpm-spring-boot-starter/src/main/java/org/pbinitiative/zenbpm/grpc/ZenbpmJobWorkerManager.java similarity index 97% rename from zenbpm-spring-boot-starter/src/main/java/org/zenbpm/grpc/ZenbpmJobWorkerManager.java rename to zenbpm-spring-boot-starter/src/main/java/org/pbinitiative/zenbpm/grpc/ZenbpmJobWorkerManager.java index 5ef25cd..27cd41a 100644 --- a/zenbpm-spring-boot-starter/src/main/java/org/zenbpm/grpc/ZenbpmJobWorkerManager.java +++ b/zenbpm-spring-boot-starter/src/main/java/org/pbinitiative/zenbpm/grpc/ZenbpmJobWorkerManager.java @@ -1,4 +1,4 @@ -package org.zenbpm.grpc; +package org.pbinitiative.zenbpm.grpc; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; @@ -22,9 +22,9 @@ import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.context.SmartLifecycle; import org.springframework.util.ReflectionUtils; -import org.zenbpm.ZenbpmClientProperties; -import org.zenbpm.proto.ZenBpmGrpc; -import org.zenbpm.proto.Zenbpm; +import org.pbinitiative.zenbpm.ZenbpmClientProperties; +import org.pbinitiative.zenbpm.proto.ZenBpmGrpc; +import org.pbinitiative.zenbpm.proto.Zenbpm; import java.lang.reflect.Method; import java.util.*; @@ -142,7 +142,7 @@ private void dispatchJob(Zenbpm.WaitingJob job) { } OpenTelemetry otel = !isOtelDisabled ? openTelemetry.getIfAvailable() : null; - Tracer tracer = (otel != null) ? otel.getTracer("org.zenbpm.grpc") : null; + Tracer tracer = (otel != null) ? otel.getTracer("org.pbinitiative.zenbpm.grpc") : null; Span span = (tracer != null) ? tracer.spanBuilder("zenbpm.job.process").setSpanKind(SpanKind.CONSUMER).startSpan() diff --git a/zenbpm-spring-boot-starter/src/main/java/org/zenbpm/rest/ZenbpmClientService.java b/zenbpm-spring-boot-starter/src/main/java/org/pbinitiative/zenbpm/rest/ZenbpmClientService.java similarity index 93% rename from zenbpm-spring-boot-starter/src/main/java/org/zenbpm/rest/ZenbpmClientService.java rename to zenbpm-spring-boot-starter/src/main/java/org/pbinitiative/zenbpm/rest/ZenbpmClientService.java index 8715cf7..8443336 100644 --- a/zenbpm-spring-boot-starter/src/main/java/org/zenbpm/rest/ZenbpmClientService.java +++ b/zenbpm-spring-boot-starter/src/main/java/org/pbinitiative/zenbpm/rest/ZenbpmClientService.java @@ -1,4 +1,4 @@ -package org.zenbpm.rest; +package org.pbinitiative.zenbpm.rest; import io.opentelemetry.api.OpenTelemetry; import okhttp3.OkHttpClient; @@ -6,8 +6,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.ObjectProvider; -import org.zenbpm.ZenbpmClientProperties; -import org.zenbpm.client.ApiClient; +import org.pbinitiative.zenbpm.ZenbpmClientProperties; +import org.pbinitiative.zenbpm.client.ApiClient; public class ZenbpmClientService { diff --git a/zenbpm-spring-boot-starter/src/main/java/org/zenbpm/rest/ZenbpmOkHttpOtelInterceptor.java b/zenbpm-spring-boot-starter/src/main/java/org/pbinitiative/zenbpm/rest/ZenbpmOkHttpOtelInterceptor.java similarity index 94% rename from zenbpm-spring-boot-starter/src/main/java/org/zenbpm/rest/ZenbpmOkHttpOtelInterceptor.java rename to zenbpm-spring-boot-starter/src/main/java/org/pbinitiative/zenbpm/rest/ZenbpmOkHttpOtelInterceptor.java index 671c532..1b89ae5 100644 --- a/zenbpm-spring-boot-starter/src/main/java/org/zenbpm/rest/ZenbpmOkHttpOtelInterceptor.java +++ b/zenbpm-spring-boot-starter/src/main/java/org/pbinitiative/zenbpm/rest/ZenbpmOkHttpOtelInterceptor.java @@ -1,4 +1,4 @@ -package org.zenbpm.rest; +package org.pbinitiative.zenbpm.rest; import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.api.trace.Span; @@ -19,7 +19,7 @@ public final class ZenbpmOkHttpOtelInterceptor implements Interceptor { public ZenbpmOkHttpOtelInterceptor(OpenTelemetry openTelemetry) { this.openTelemetry = openTelemetry; - this.tracer = openTelemetry.getTracer("org.zenbpm.rest"); + this.tracer = openTelemetry.getTracer("org.pbinitiative.zenbpm.rest"); } @Override diff --git a/zenbpm-spring-boot-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/zenbpm-spring-boot-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index ea92ccc..70d5f29 100644 --- a/zenbpm-spring-boot-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ b/zenbpm-spring-boot-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -1 +1 @@ -org.zenbpm.ZenbpmClientAutoConfiguration +org.pbinitiative.zenbpm.ZenbpmClientAutoConfiguration