@camunda8/orchestration-cluster-api
    Preparing search index...

    Class CamundaClient

    Index

    Constructors

    Accessors

    Methods

    _getSupportLogger _invokeWithRetry activateAdHocSubProcessActivities activateJobs assignClientToGroup assignClientToTenant assignGroupToTenant assignMappingRuleToGroup assignMappingRuleToTenant assignRoleToClient assignRoleToGroup assignRoleToMappingRule assignRoleToTenant assignRoleToUser assignUserTask assignUserToGroup assignUserToTenant broadcastSignal cancelBatchOperation cancelProcessInstance cancelProcessInstancesBatchOperation clearAuthCache completeJob completeUserTask configure correlateMessage createAdminUser createAuthorization createDeployment createDocument createDocumentLink createDocuments createElementInstanceVariables createGlobalClusterVariable createGlobalTaskListener createGroup createJobWorker createMappingRule createProcessInstance createRole createTenant createTenantClusterVariable createUser deleteAuthorization deleteDecisionInstance deleteDecisionInstancesBatchOperation deleteDocument deleteGlobalClusterVariable deleteGlobalTaskListener deleteGroup deleteMappingRule deleteProcessInstance deleteProcessInstancesBatchOperation deleteResource deleteRole deleteTenant deleteTenantClusterVariable deleteUser deployResourcesFromFiles emitSupportLogPreamble evaluateConditionals evaluateDecision evaluateExpression failJob forceAuthRefresh getAuditLog getAuthentication getAuthHeaders getAuthorization getBackpressureState getBatchOperation getConfig getDecisionDefinition getDecisionDefinitionXml getDecisionInstance getDecisionRequirements getDecisionRequirementsXml getDocument getElementInstance getErrorMode getGlobalClusterVariable getGlobalJobStatistics getGroup getIncident getLicense getMappingRule getProcessDefinition getProcessDefinitionInstanceStatistics getProcessDefinitionInstanceVersionStatistics getProcessDefinitionMessageSubscriptionStatistics getProcessDefinitionStatistics getProcessDefinitionXml getProcessInstance getProcessInstanceCallHierarchy getProcessInstanceSequenceFlows getProcessInstanceStatistics getProcessInstanceStatisticsByDefinition getProcessInstanceStatisticsByError getResource getResourceContent getRole getStartProcessForm getStatus getTenant getTenantClusterVariable getTopology getUsageMetrics getUser getUserTask getUserTaskForm getVariable getWorkers logger migrateProcessInstance migrateProcessInstancesBatchOperation modifyProcessInstance modifyProcessInstancesBatchOperation onAuthHeaders pinClock publishMessage resetClock resolveIncident resolveIncidentsBatchOperation resolveProcessInstanceIncidents resumeBatchOperation searchAuditLogs searchAuthorizations searchBatchOperationItems searchBatchOperations searchClientsForGroup searchClientsForRole searchClientsForTenant searchClusterVariables searchCorrelatedMessageSubscriptions searchDecisionDefinitions searchDecisionInstances searchDecisionRequirements searchElementInstanceIncidents searchElementInstances searchGroupIdsForTenant searchGroups searchGroupsForRole searchIncidents searchJobs searchMappingRule searchMappingRulesForGroup searchMappingRulesForRole searchMappingRulesForTenant searchMessageSubscriptions searchProcessDefinitions searchProcessInstanceIncidents searchProcessInstances searchRoles searchRolesForGroup searchRolesForTenant searchTenants searchUsers searchUsersForGroup searchUsersForRole searchUsersForTenant searchUserTaskAuditLogs searchUserTasks searchUserTaskVariables searchVariables stopAllWorkers suspendBatchOperation throwJobError unassignClientFromGroup unassignClientFromTenant unassignGroupFromTenant unassignMappingRuleFromGroup unassignMappingRuleFromTenant unassignRoleFromClient unassignRoleFromGroup unassignRoleFromMappingRule unassignRoleFromTenant unassignRoleFromUser unassignUserFromGroup unassignUserFromTenant unassignUserTask updateAuthorization updateGlobalClusterVariable updateGlobalTaskListener updateGroup updateJob updateMappingRule updateRole updateTenant updateTenantClusterVariable updateUser updateUserTask withCorrelation

    Constructors

    Accessors

    Methods

    • Internal invocation helper to apply global backpressure gating + retry + normalization

      Type Parameters

      • T

      Parameters

      • op: () => Promise<T>
      • opts: {
            classify?: (e: any) => { reason: string; retryable: boolean };
            exempt?: boolean;
            opId: string;
        }

      Returns Promise<T>

    • Activate jobs

      Iterate through all known partitions and activate jobs up to the requested maximum.

      Parameters

      Returns CancelablePromise<{ jobs: EnrichedActivatedJob[] }>

      async function activateJobsExample() {
      const camunda = createCamundaClient();

      const result = await camunda.activateJobs({
      type: 'payment-processing',
      timeout: 30000,
      maxJobsToActivate: 5,
      });

      for (const job of result.jobs) {
      console.log(`Job ${job.jobKey}: ${job.type}`);

      // Each enriched job has helper methods
      await job.complete({ paymentId: 'PAY-123' });
      }
      }

      activateJobs

      Job

    • Assign user task

      Assigns a user task with the given key to the given assignee. *

      Parameters

      Returns CancelablePromise<void>

      async function assignUserTaskExample() {
      const camunda = createCamundaClient();

      const userTaskKey = UserTaskKey.assumeExists('2251799813685249');

      await camunda.assignUserTask({
      userTaskKey,
      assignee: 'alice',
      allowOverride: true,
      });
      }

      assignUserTask

      User task

    • Cancel process instance

      Cancels a running process instance. As a cancellation includes more than just the removal of the process instance resource, the cancellation resource must be posted. *

      Parameters

      Returns CancelablePromise<void>

      async function cancelProcessInstanceExample() {
      const camunda = createCamundaClient();

      // Create a process instance and get its key from the response
      const created = await camunda.createProcessInstance({
      processDefinitionId: ProcessDefinitionId.assumeExists('order-process'),
      });

      // Cancel the process instance using the key from the creation response
      await camunda.cancelProcessInstance({
      processInstanceKey: created.processInstanceKey,
      });
      }

      cancelProcessInstance

      Process instance

    • Parameters

      • Optionalopts: { disk?: boolean; memory?: boolean }

      Returns void

    • Complete job

      Complete a job with the given payload, which allows completing the associated service task.

      Parameters

      Returns CancelablePromise<void>

      async function completeJobExample() {
      const camunda = createCamundaClient();

      const jobKey = JobKey.assumeExists('2251799813685249');

      await camunda.completeJob({
      jobKey,
      variables: {
      paymentId: 'PAY-123',
      status: 'completed',
      },
      });
      }

      completeJob

      Job

    • Complete user task

      Completes a user task with the given key. *

      Parameters

      Returns CancelablePromise<void>

      async function completeUserTaskExample() {
      const camunda = createCamundaClient();

      const userTaskKey = UserTaskKey.assumeExists('2251799813685249');

      await camunda.completeUserTask({
      userTaskKey,
      variables: {
      approved: true,
      comment: 'Looks good',
      },
      });
      }

      completeUserTask

      User task

    • Correlate message

      Publishes a message and correlates it to a subscription. If correlation is successful it will return the first process instance key the message correlated with. The message is not buffered. Use the publish message endpoint to send messages that can be buffered.

      Parameters

      Returns CancelablePromise<MessageCorrelationResult>

      async function correlateMessageExample() {
      const camunda = createCamundaClient();

      const result = await camunda.correlateMessage({
      name: 'order-payment-received',
      correlationKey: 'ORD-12345',
      variables: {
      paymentId: 'PAY-123',
      amount: 99.95,
      },
      });

      console.log(`Message correlated to: ${result.processInstanceKey}`);
      }

      correlateMessage

      Message

    • Deploy resources

      Deploys one or more resources (e.g. processes, decision models, or forms). This is an atomic call, i.e. either all resources are deployed or none of them are.

      Parameters

      Returns CancelablePromise<ExtendedDeploymentResult>

      Enriched deployment result with typed arrays (processes, decisions, decisionRequirements, forms, resources).

      async function createDeploymentExample() {
      const camunda = createCamundaClient();

      const file = new File(['<xml/>'], 'order-process.bpmn', { type: 'application/xml' });

      const result = await camunda.createDeployment({
      resources: [file],
      });

      console.log(`Deployment key: ${result.deploymentKey}`);
      for (const process of result.processes ?? []) {
      console.log(` Process: ${process.processDefinitionId} v${process.processDefinitionVersion}`);
      }
      }

      createDeployment

      Resource

    • Upload multiple documents

      Upload multiple documents to the Camunda 8 cluster.

      The caller must provide a file name for each document, which will be used in case of a multi-status response to identify which documents failed to upload. The file name can be provided in the Content-Disposition header of the file part or in the fileName field of the metadata. You can add a parallel array of metadata objects. These are matched with the files based on index, and must have the same length as the files array. To pass homogenous metadata for all files, spread the metadata over the metadata array. A filename value provided explicitly via the metadata array in the request overrides the Content-Disposition header of the file part.

      In case of a multi-status response, the response body will contain a list of DocumentBatchProblemDetail objects, each of which contains the file name of the document that failed to upload and the reason for the failure. The client can choose to retry the whole batch or individual documents based on the response.

      Note that this is currently supported for document stores of type: AWS, GCP, in-memory (non-production), local (non-production)

      Parameters

      Returns CancelablePromise<DocumentCreationBatchResponse>

      createDocuments

      Document

    • Create a job worker that activates and processes jobs of the given type.

      Type Parameters

      • In extends ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>> = any
      • Out extends ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>> = any
      • Headers extends ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>> = any

      Parameters

      Returns JobWorker

      async function createJobWorkerExample() {
      const camunda = createCamundaClient();

      const worker = camunda.createJobWorker({
      jobType: 'payment-processing',
      jobTimeoutMs: 30000,
      maxParallelJobs: 5,
      jobHandler: async (job): Promise<JobActionReceipt> => {
      console.log(`Processing job ${job.jobKey}`);
      return job.complete({ processed: true });
      },
      });

      // Workers run continuously until closed
      // worker.close();
      }
      async function jobWorkerWithErrorHandlingExample() {
      const camunda = createCamundaClient();

      const worker = camunda.createJobWorker({
      jobType: 'email-sending',
      jobTimeoutMs: 60000,
      maxParallelJobs: 10,
      pollIntervalMs: 300,
      jobHandler: async (job): Promise<JobActionReceipt> => {
      try {
      console.log(`Sending email for job ${job.jobKey}`);
      return job.complete({ sent: true });
      } catch (err) {
      return job.fail({
      errorMessage: String(err),
      retries: (job.retries ?? 1) - 1,
      });
      }
      },
      });

      void worker;
      }
    • Create process instance

      Creates and starts an instance of the specified process. The process definition to use to create the instance can be specified either using its unique key (as returned by Deploy resources), or using the BPMN process id and a version.

      Waits for the completion of the process instance before returning a result when awaitCompletion is enabled.

      Returns CancelablePromise<CreateProcessInstanceResult>

      async function createProcessInstanceByIdExample() {
      const camunda = createCamundaClient();

      const result = await camunda.createProcessInstance({
      processDefinitionId: ProcessDefinitionId.assumeExists('order-process'),
      variables: {
      orderId: 'ORD-12345',
      amount: 99.95,
      },
      });

      console.log(`Started process instance: ${result.processInstanceKey}`);
      }
      async function createProcessInstanceByKeyExample() {
      const camunda = createCamundaClient();

      // Key from a previous API response (e.g. deployment)
      const processDefinitionKey = ProcessDefinitionKey.assumeExists('2251799813685249');

      const result = await camunda.createProcessInstance({
      processDefinitionKey,
      variables: {
      orderId: 'ORD-12345',
      amount: 99.95,
      },
      });

      console.log(`Started process instance: ${result.processInstanceKey}`);
      }

      createProcessInstance

      Process instance

    • Delete resource

      Deletes a deployed resource. This can be a process definition, decision requirements definition, or form definition deployed using the deploy resources endpoint. Specify the resource you want to delete in the resourceKey parameter.

      Once a resource has been deleted it cannot be recovered. If the resource needs to be available again, a new deployment of the resource is required.

      By default, only the resource itself is deleted from the runtime state. To also delete the historic data associated with a resource, set the deleteHistory flag in the request body to true. The historic data is deleted asynchronously via a batch operation. The details of the created batch operation are included in the response. Note that history deletion is only supported for process resources; for other resource types this flag is ignored and no history will be deleted. *

      Parameters

      • input: { deleteHistory?: boolean; operationReference?: number } & {
            resourceKey: ResourceKey;
        }
        • OptionaldeleteHistory?: boolean

          Indicates if the historic data of a process resource should be deleted via a batch operation asynchronously.

          This flag is only effective for process resources. For other resource types (decisions, forms, generic resources), this flag is ignored and no history will be deleted. In those cases, the batchOperation field in the response will not be populated.

        • OptionaloperationReference?: number

      Returns CancelablePromise<DeleteResourceResponse>

      async function deleteResourceExample() {
      const camunda = createCamundaClient();

      // Use a process definition key as a resource key for deletion
      const resourceKey = ProcessDefinitionKey.assumeExists('2251799813685249');

      await camunda.deleteResource({
      resourceKey,
      });
      }

      deleteResource

      Resource

    • Emit the standard support log preamble & redacted configuration to the current support logger. Safe to call multiple times; subsequent calls are ignored (idempotent). Useful when a custom supportLogger was injected and you still want the canonical header & config dump.

      Returns void

    • Evaluate decision

      Evaluates a decision. You specify the decision to evaluate either by using its unique key (as returned by DeployResource), or using the decision ID. When using the decision ID, the latest deployed version of the decision is used.

      Returns CancelablePromise<EvaluateDecisionResult>

      async function evaluateDecisionByIdExample() {
      const camunda = createCamundaClient();

      const result = await camunda.evaluateDecision({
      decisionDefinitionId: DecisionDefinitionId.assumeExists('invoice-classification'),
      variables: {
      amount: 1000,
      invoiceCategory: 'Misc',
      },
      });

      console.log(`Decision: ${result.decisionDefinitionId}`);
      console.log(`Output: ${result.output}`);
      }
      async function evaluateDecisionByKeyExample() {
      const camunda = createCamundaClient();

      const decisionDefinitionKey = DecisionDefinitionKey.assumeExists('2251799813685249');

      const result = await camunda.evaluateDecision({
      decisionDefinitionKey,
      variables: {
      amount: 1000,
      invoiceCategory: 'Misc',
      },
      });

      console.log(`Decision output: ${result.output}`);
      }

      evaluateDecision

      Decision definition

    • Fail job

      Mark the job as failed.

      Parameters

      Returns CancelablePromise<void>

      async function failJobExample() {
      const camunda = createCamundaClient();

      const jobKey = JobKey.assumeExists('2251799813685249');

      await camunda.failJob({
      jobKey,
      retries: 2,
      errorMessage: 'Payment gateway timeout',
      retryBackOff: 5000,
      });
      }

      failJob

      Job

    • Public accessor for current backpressure adaptive limiter state (stable)

      Returns
          | {
              consecutive: number;
              permitsCurrent: number;
              permitsMax: number
              | null;
              severity: BackpressureSeverity;
              waiters: number;
          }
          | {
              consecutive: number;
              permitsCurrent: number;
              permitsMax: null;
              severity: string;
              waiters: number;
          }

    • Internal accessor (read-only) for eventual consistency error mode.

      Returns "result" | "throw"

    • Get incident

      Returns incident as JSON.

      Parameters

      Returns CancelablePromise<IncidentResult>

      async function getIncidentExample() {
      const camunda = createCamundaClient();

      const incidentKey = IncidentKey.assumeExists('2251799813685249');

      const incident = await camunda.getIncident(
      { incidentKey },
      { consistency: { waitUpToMs: 5000 } }
      );

      console.log(`Type: ${incident.errorType}`);
      console.log(`State: ${incident.state}`);
      console.log(`Message: ${incident.errorMessage}`);
      }

      getIncident

      Incident

      eventual - this endpoint is backed by data that is eventually consistent with the system state.

    • Get cluster topology

      Obtains the current topology of the cluster the gateway is part of. *

      Returns CancelablePromise<TopologyResponse>

      async function getTopologyExample() {
      const camunda = createCamundaClient();

      const topology = await camunda.getTopology();

      console.log(`Cluster size: ${topology.clusterSize}`);
      console.log(`Partitions: ${topology.partitionsCount}`);
      for (const broker of topology.brokers ?? []) {
      console.log(` Broker ${broker.nodeId}: ${broker.host}:${broker.port}`);
      }
      }

      getTopology

      Cluster

    • Return a read-only snapshot of currently registered job workers.

      Returns any[]

    • Migrate process instance

      Migrates a process instance to a new process definition. This request can contain multiple mapping instructions to define mapping between the active process instance's elements and target process definition elements.

      Use this to upgrade a process instance to a new version of a process or to a different process definition, e.g. to keep your running instances up-to-date with the latest process improvements.

      Returns CancelablePromise<void>

      migrateProcessInstance

      Process instance

    • Modify process instance

      Modifies a running process instance. This request can contain multiple instructions to activate an element of the process or to terminate an active instance of an element.

      Use this to repair a process instance that is stuck on an element or took an unintended path. For example, because an external system is not available or doesn't respond as expected.

      Returns CancelablePromise<void>

      modifyProcessInstance

      Process instance

    • Parameters

      • h: (
            headers: Record<string, string>,
        ) => Record<string, string> | Promise<Record<string, string>>

      Returns void

    • Pin internal clock (alpha)

      Set a precise, static time for the Zeebe engine's internal clock. When the clock is pinned, it remains at the specified time and does not advance. To change the time, the clock must be pinned again with a new timestamp.

      This endpoint is an alpha feature and may be subject to change in future releases.

      Parameters

      Returns CancelablePromise<void>

      pinClock

      Clock

    • Publish message

      Publishes a single message. Messages are published to specific partitions computed from their correlation keys. Messages can be buffered. The endpoint does not wait for a correlation result. Use the message correlation endpoint for such use cases.

      Parameters

      Returns CancelablePromise<MessagePublicationResult>

      async function publishMessageExample() {
      const camunda = createCamundaClient();

      await camunda.publishMessage({
      name: 'order-payment-received',
      correlationKey: 'ORD-12345',
      timeToLive: 60000,
      variables: {
      paymentId: 'PAY-123',
      },
      });
      }

      publishMessage

      Message

    • Reset internal clock (alpha)

      Resets the Zeebe engine's internal clock to the current system time, enabling it to tick in real-time. This operation is useful for returning the clock to normal behavior after it has been pinned to a specific time.

      This endpoint is an alpha feature and may be subject to change in future releases.

      Returns CancelablePromise<void>

      resetClock

      Clock

    • Resolve incident

      Marks the incident as resolved; most likely a call to Update job will be necessary to reset the job's retries, followed by this call.

      Parameters

      Returns CancelablePromise<void>

      async function resolveIncidentExample() {
      const camunda = createCamundaClient();

      const incidentKey = IncidentKey.assumeExists('2251799813685249');

      await camunda.resolveIncident({ incidentKey });
      }

      resolveIncident

      Incident

    • Search incidents

      Search for incidents based on given criteria.

      Parameters

      Returns CancelablePromise<IncidentSearchQueryResult>

      async function searchIncidentsExample() {
      const camunda = createCamundaClient();

      const result = await camunda.searchIncidents(
      {
      filter: { state: 'ACTIVE' },
      sort: [{ field: 'creationTime', order: 'DESC' }],
      page: { limit: 20 },
      },
      { consistency: { waitUpToMs: 5000 } }
      );

      for (const incident of result.items ?? []) {
      console.log(`${incident.incidentKey}: ${incident.errorType}${incident.errorMessage}`);
      }
      console.log(`Total active incidents: ${result.page.totalItems}`);
      }

      searchIncidents

      Incident

      eventual - this endpoint is backed by data that is eventually consistent with the system state.

    • Unassign user task

      Removes the assignee of a task with the given key. *

      Parameters

      Returns CancelablePromise<void>

      async function unassignUserTaskExample() {
      const camunda = createCamundaClient();

      const userTaskKey = UserTaskKey.assumeExists('2251799813685249');

      await camunda.unassignUserTask({ userTaskKey });
      }

      unassignUserTask

      User task

    • Type Parameters

      • T

      Parameters

      • id: string
      • fn: () => T | Promise<T>

      Returns Promise<T>