Class CamundaClientImpl

java.lang.Object
io.camunda.client.impl.CamundaClientImpl
All Implemented Interfaces:
JobClient, CamundaClient, AutoCloseable

public final class CamundaClientImpl extends Object implements CamundaClient
  • Constructor Details

  • Method Details

    • buildChannel

      public static io.grpc.ManagedChannel buildChannel(CamundaClientConfiguration config)
    • buildGatewayStub

      public static GatewayGrpc.GatewayStub buildGatewayStub(io.grpc.ManagedChannel channel, CamundaClientConfiguration config)
    • newTopologyRequest

      public TopologyRequestStep1 newTopologyRequest()
      Description copied from interface: CamundaClient
      Request the current cluster topology. Can be used to inspect which brokers are available at which endpoint and which broker is the leader of which partition.
       List<BrokerInfo> brokers = camundaClient
        .newTopologyRequest()
        .send()
        .join()
        .getBrokers();
      
        InetSocketAddress address = broker.getSocketAddress();
      
        List<PartitionInfo> partitions = broker.getPartitions();
       
      Specified by:
      newTopologyRequest in interface CamundaClient
      Returns:
      the request where you must call send()
    • getConfiguration

      public CamundaClientConfiguration getConfiguration()
      Specified by:
      getConfiguration in interface CamundaClient
      Returns:
      the client's configuration
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface CamundaClient
    • newDeployCommand

      public DeployProcessCommandStep1 newDeployCommand()
      Description copied from interface: CamundaClient
      Command to deploy new processes.
       camundaClient
        .newDeployCommand()
        .addResourceFile("~/wf/process1.bpmn")
        .addResourceFile("~/wf/process2.bpmn")
        .send();
       
      Specified by:
      newDeployCommand in interface CamundaClient
      Returns:
      a builder for the command
    • newDeployResourceCommand

      public DeployResourceCommandStep1 newDeployResourceCommand()
      Description copied from interface: CamundaClient
      Command to deploy new resources, i.e. BPMN process models and DMN decision models.
       camundaClient
        .newDeployCommand()
        .addResourceFile("~/wf/process1.bpmn")
        .addResourceFile("~/wf/process2.bpmn")
        .addResourceFile("~/dmn/decision.dmn")
        .send();
       
      Specified by:
      newDeployResourceCommand in interface CamundaClient
      Returns:
      a builder for the command
    • newCreateInstanceCommand

      public CreateProcessInstanceCommandStep1 newCreateInstanceCommand()
      Description copied from interface: CamundaClient
      Command to create/start a new instance of a process.
       camundaClient
        .newCreateInstanceCommand()
        .bpmnProcessId("my-process")
        .latestVersion()
        .variables(json)
        .send();
       
      Specified by:
      newCreateInstanceCommand in interface CamundaClient
      Returns:
      a builder for the command
    • newModifyProcessInstanceCommand

      public ModifyProcessInstanceCommandStep1 newModifyProcessInstanceCommand(long processInstanceKey)
      Description copied from interface: CamundaClient
      Command to modify a process instance.
         camundaClient
          .newModifyProcessInstanceCommand(processInstanceKey)
          .activateElement("element1")
          .and()
          .activateElement("element2")
          .withVariables(globalScopedVariables)
          .withVariables(localScopedVariables, "element2")
          .and()
          .terminateElement("element3")
          .send();
       
      Specified by:
      newModifyProcessInstanceCommand in interface CamundaClient
      Parameters:
      processInstanceKey - the key which identifies the corresponding process instance
      Returns:
      a builder for the command
    • newMigrateProcessInstanceCommand

      public MigrateProcessInstanceCommandStep1 newMigrateProcessInstanceCommand(long processInstanceKey)
      Description copied from interface: CamundaClient
      Command to migrate a process instance to a different process definition.

      The migration command contains a migration plan. Migration plan contains targetProcessDefinitionKey to indicate which process definition to use for the migration. Mapping instructions for the migration describe how to map elements from the source process definition to the target process definition.

      For example, let's consider we want to migrate process instance with key 1, target process definition key 2, a source process definition with a service task with id "task1" and the target process definition with a service task with id "task2". The migration command could be:

      
       {
        "processInstanceKey": 1,
        "migrationPlan": {
         "targetProcessDefinitionKey": 2,
         "mappingInstructions": [
          {
           "sourceElementId": "task1",
           "targetElementId": "task2"
          }
         ]
        }
       }
       
      
       camundaClient
        .newMigrateProcessInstanceCommand(1L)
        .migrationPlan(2L)
        .addMappingInstruction("element1", "element2")
        .addMappingInstruction("element3", "element4")
        .send();
       
       final MigrationPlan migrationPlan =
               MigrationPlan.newBuilder()
                   .withTargetProcessDefinitionKey(2L)
                   .addMappingInstruction("element1", "element2")
                   .addMappingInstruction("element3", "element4")
                   .build();
       camundaClient
        .newMigrateProcessInstanceCommand(1L)
        .migrationPlan(migrationPlan)
        .send();
       
      Specified by:
      newMigrateProcessInstanceCommand in interface CamundaClient
      Parameters:
      processInstanceKey - the key which refers to the process instance to migrate
      Returns:
      a builder for the command
    • newCancelInstanceCommand

      public CancelProcessInstanceCommandStep1 newCancelInstanceCommand(long processInstanceKey)
      Description copied from interface: CamundaClient
      Command to cancel a process instance.
       camundaClient
        .newCancelInstanceCommand(processInstanceKey)
        .send();
       
      Specified by:
      newCancelInstanceCommand in interface CamundaClient
      Parameters:
      processInstanceKey - the key which identifies the corresponding process instance
      Returns:
      a builder for the command
    • newSetVariablesCommand

      public SetVariablesCommandStep1 newSetVariablesCommand(long elementInstanceKey)
      Description copied from interface: CamundaClient
      Command to set and/or update the variables of a given flow element (e.g. process instance, task, etc.)
       camundaClient
        .newSetVariablesCommand(elementInstanceKey)
        .variables(json)
        .send();
       
      Specified by:
      newSetVariablesCommand in interface CamundaClient
      Parameters:
      elementInstanceKey - the key of the element instance to set/update the variables for
      Returns:
      a builder for the command
    • newEvaluateDecisionCommand

      public EvaluateDecisionCommandStep1 newEvaluateDecisionCommand()
      Description copied from interface: CamundaClient
      Command to evaluate a decision.
       camundaClient
        .newEvaluateDecisionCommand()
        .decisionKey("my-decision")
        .variables(json)
        .send();
       
      Specified by:
      newEvaluateDecisionCommand in interface CamundaClient
      Returns:
      a builder for the command
    • newPublishMessageCommand

      public PublishMessageCommandStep1 newPublishMessageCommand()
      Description copied from interface: CamundaClient
      Command to publish a message which can be correlated to a process instance.
       camundaClient
        .newPublishMessageCommand()
        .messageName("order canceled")
        .correlationKey(orderId)
        .variables(json)
        .send();
       
      Specified by:
      newPublishMessageCommand in interface CamundaClient
      Returns:
      a builder for the command
    • newCorrelateMessageCommand

      public CorrelateMessageCommandStep1 newCorrelateMessageCommand()
      Description copied from interface: CamundaClient
      Command to correlate a message and wait for it to be correlated against a process instance.
       camundaClient
        .newCorrelateMessageCommand()
        .messageName("order canceled")
        .correlationKey(orderId)
        .variables(json)
        .tenantId("tenant")
        .send();
       
      Specified by:
      newCorrelateMessageCommand in interface CamundaClient
      Returns:
      a builder for the command
    • newBroadcastSignalCommand

      public BroadcastSignalCommandStep1 newBroadcastSignalCommand()
      Description copied from interface: CamundaClient
      Command to broadcast a signal.
       camundaClient
        .newBroadcastSignalCommand()
        .signalName("signal")
        .variables(json)
        .send();
       
      Specified by:
      newBroadcastSignalCommand in interface CamundaClient
      Returns:
      a builder for the command
    • newResolveIncidentCommand

      public ResolveIncidentCommandStep1 newResolveIncidentCommand(long incidentKey)
      Description copied from interface: CamundaClient
      Command to resolve an existing incident.
       camundaClient
        .newResolveIncidentCommand(incidentKey)
        .send();
       
      Specified by:
      newResolveIncidentCommand in interface CamundaClient
      Parameters:
      incidentKey - the key of the corresponding incident
      Returns:
      the builder for the command
    • newUpdateRetriesCommand

      public UpdateRetriesJobCommandStep1 newUpdateRetriesCommand(long jobKey)
      Description copied from interface: CamundaClient
      Command to update the retries of a job.
       long jobKey = ..;
      
       camundaClient
        .newUpdateRetriesCommand(jobKey)
        .retries(3)
        .send();
       

      If the given retries are greater than zero then this job will be picked up again by a job worker. This will not close a related incident, which still has to be marked as resolved with newResolveIncidentCommand(long incidentKey) .

      Specified by:
      newUpdateRetriesCommand in interface CamundaClient
      Parameters:
      jobKey - the key of the job to update
      Returns:
      a builder for the command
    • newUpdateRetriesCommand

      public UpdateRetriesJobCommandStep1 newUpdateRetriesCommand(ActivatedJob job)
      Description copied from interface: CamundaClient
      Command to update the retries of a job.
       ActivatedJob job= ..;
      
       camundaClient
        .newUpdateRetriesCommand(job)
        .retries(3)
        .send();
       

      If the given retries are greater than zero then this job will be picked up again by a job worker. This will not close a related incident, which still has to be marked as resolved with newResolveIncidentCommand(long incidentKey) .

      Specified by:
      newUpdateRetriesCommand in interface CamundaClient
      Parameters:
      job - the activated job
      Returns:
      a builder for the command
    • newUpdateTimeoutCommand

      public UpdateTimeoutJobCommandStep1 newUpdateTimeoutCommand(long jobKey)
      Description copied from interface: CamundaClient
      Command to update the timeout of a job.
       long jobKey = ..;
      
       camundaClient
        .newUpdateTimeoutCommand(jobKey)
        .timeout(100)
        .send();
       

      Timeout value in millis is used to calculate a new job deadline. This will happen when the command to update the timeline is processed. The timeout value will be added to the current time then.

      Specified by:
      newUpdateTimeoutCommand in interface CamundaClient
      Parameters:
      jobKey - the key of the job to update
      Returns:
      a builder for the command
    • newUpdateTimeoutCommand

      public UpdateTimeoutJobCommandStep1 newUpdateTimeoutCommand(ActivatedJob job)
      Description copied from interface: CamundaClient
      Command to update the timeout of a job.
       ActivatedJob job= ..;
      
       camundaClient
        .newUpdateTimeoutCommand(job)
        .timeout(100)
        .send();
       

      Timeout value in millis is used to calculate a new job deadline. This will happen when the command to update the timeline is processed. The timeout value will be added to the current time then.

      Specified by:
      newUpdateTimeoutCommand in interface CamundaClient
      Parameters:
      job - the activated job
      Returns:
      a builder for the command
    • newWorker

      public JobWorkerBuilderStep1 newWorker()
      Description copied from interface: CamundaClient
      Registers a new job worker for jobs of a given type.

      After registration, the broker activates available jobs and assigns them to this worker. It then publishes them to the client. The given worker is called for every received job, works on them and eventually completes them.

       JobWorker worker = camundaClient
        .newWorker()
        .jobType("payment")
        .handler(paymentHandler)
        .open();
      
       ...
       worker.close();
       
      Example JobHandler implementation:
       public final class PaymentHandler implements JobHandler
       {
         @Override
         public void handle(JobClient client, JobEvent jobEvent)
         {
           String json = jobEvent.getVariables();
           // modify variables
      
           client
            .newCompleteCommand()
            .event(jobEvent)
            .variables(json)
            .send();
         }
       };
       
      Specified by:
      newWorker in interface CamundaClient
      Returns:
      a builder for the worker registration
    • newDeleteResourceCommand

      public DeleteResourceCommandStep1 newDeleteResourceCommand(long resourceKey)
      Description copied from interface: CamundaClient
      Command to delete a resource.
       camundaClient
        .newDeleteResourceCommand(resourceKey)
        .send();
       
      Specified by:
      newDeleteResourceCommand in interface CamundaClient
      Parameters:
      resourceKey - the key of the resource
      Returns:
      the builder for the command
    • newUserTaskCompleteCommand

      public CompleteUserTaskCommandStep1 newUserTaskCompleteCommand(long userTaskKey)
      Description copied from interface: CamundaClient
      Command to complete a user task.
       long userTaskKey = ..;
      
       camundaClient
        .newUserTaskCompleteCommand(userTaskKey)
        .variables(map)
        .send();
       

      If the user task is linked to a process instance then this command will complete the related activity and continue the flow.

      This command is only sent via REST over HTTP, not via gRPC

      Specified by:
      newUserTaskCompleteCommand in interface CamundaClient
      Parameters:
      userTaskKey - the key of the user task
      Returns:
      a builder for the command
    • newUserTaskAssignCommand

      public AssignUserTaskCommandStep1 newUserTaskAssignCommand(long userTaskKey)
      Description copied from interface: CamundaClient
      Command to assign a user task.
       long userTaskKey = ..;
      
       camundaClient
        .newUserTaskAssignCommand(userTaskKey)
        .assignee(newAssignee)
        .send();
       

      This command is only sent via REST over HTTP, not via gRPC

      Specified by:
      newUserTaskAssignCommand in interface CamundaClient
      Parameters:
      userTaskKey - the key of the user task
      Returns:
      a builder for the command
    • newUserTaskUpdateCommand

      public UpdateUserTaskCommandStep1 newUserTaskUpdateCommand(long userTaskKey)
      Description copied from interface: CamundaClient
      Command to update a user task.
       long userTaskKey = ..;
      
       camundaClient
        .newUserTaskUpdateCommand(userTaskKey)
        .candidateGroups(newCandidateGroups)
        .send();
       

      This command is only sent via REST over HTTP, not via gRPC

      Specified by:
      newUserTaskUpdateCommand in interface CamundaClient
      Parameters:
      userTaskKey - the key of the user task
      Returns:
      a builder for the command
    • newUserTaskUnassignCommand

      public UnassignUserTaskCommandStep1 newUserTaskUnassignCommand(long userTaskKey)
      Description copied from interface: CamundaClient
      Command to unassign a user task.
       long userTaskKey = ..;
      
       camundaClient
        .newUserTaskUnassignCommand(userTaskKey)
        .send();
       

      This command is only sent via REST over HTTP, not via gRPC

      Specified by:
      newUserTaskUnassignCommand in interface CamundaClient
      Parameters:
      userTaskKey - the key of the user task
      Returns:
      a builder for the command
    • newUpdateJobCommand

      public UpdateJobCommandStep1 newUpdateJobCommand(long jobKey)
      Description copied from interface: CamundaClient
      Command to update the retries and/or the timeout of a job.
       JobChangeset changeset= ..;
      
       camundaClient
        .newUpdateCommand(jobKey)
        .update(changeset)
        .send();
       

      If the given retries are greater than zero then this job will be picked up again by a job worker. This will not close a related incident, which still has to be marked as resolved with newResolveIncidentCommand(long incidentKey) .

      Timeout value in millis is used to calculate a new job deadline. This will happen when the command to update the timeline is processed. The timeout value will be added to the current time then.

      Specified by:
      newUpdateJobCommand in interface CamundaClient
      Parameters:
      jobKey - the key of the job to update
      Returns:
      a builder for the command
    • newUpdateJobCommand

      public UpdateJobCommandStep1 newUpdateJobCommand(ActivatedJob job)
      Description copied from interface: CamundaClient
      Command to update the retries and/or the timeout of a job.
       ActivatedJob job= ..;
       JobChangeset changeset= ..;
      
       camundaClient
        .newUpdateCommand(job)
        .update(changeset)
        .send();
       

      If the given retries are greater than zero then this job will be picked up again by a job worker. This will not close a related incident, which still has to be marked as resolved with newResolveIncidentCommand(long incidentKey) .

      Timeout value in millis is used to calculate a new job deadline. This will happen when the command to update the timeline is processed. The timeout value will be added to the current time then.

      Specified by:
      newUpdateJobCommand in interface CamundaClient
      Parameters:
      job - the activated job
      Returns:
      a builder for the command
    • newClockPinCommand

      public ClockPinCommandStep1 newClockPinCommand()
      Description copied from interface: CamundaClient
      Command to pin the Zeebe engine's internal clock to a specific time.

      This method initiates a command to pin the clock to a specified time. You can specify the time using either an epoch timestamp in milliseconds or an Instant object.

      Once pinned, the clock will remain at the specified time and will not advance until another pin or reset command is issued. This is useful for scenarios where you need to simulate process execution at a specific point in time.

      Example usage:

      
       final long pinnedTime = 1742461285000L; // Thu, Mar 20, 2025 09:01:25 GMT+0000
       camundaClient
        .newClockPinCommand()
        .time(pinnedTime)
        .send();
      
       final Instant futureInstant = Instant.now().plus(Duration.ofDays(7));
       camundaClient
        .newClockPinCommand()
        .time(futureInstant)
        .send();
       

      The command is marked as experimental and may undergo changes or improvements in future releases.

      Specified by:
      newClockPinCommand in interface CamundaClient
      Returns:
      a builder for the command that allows setting either a timestamp or an instant
    • newClockResetCommand

      public ClockResetCommandStep1 newClockResetCommand()
      Description copied from interface: CamundaClient
      Command to reset the Zeebe engine's internal clock to the system time.

      This command allows you to reset the clock to the current system time, effectively undoing any previous pin command that may have set the clock to a specific, static time.

      
       camundaClient
        .newClockResetCommand()
        .send();
       

      The command is marked as experimental and may undergo changes or improvements in future releases.

      Specified by:
      newClockResetCommand in interface CamundaClient
      Returns:
      a builder for the command
    • newProcessDefinitionGetRequest

      public ProcessDefinitionGetRequest newProcessDefinitionGetRequest(long processDefinitionKey)
      Description copied from interface: CamundaClient
      Gets a process definition by key.
         long processDefinitionKey = ...;
      
         camundaClient
         .newProcessDefinitionGetRequest(processDefinitionKey)
         .send();
         
      Specified by:
      newProcessDefinitionGetRequest in interface CamundaClient
      Parameters:
      processDefinitionKey - the key of the process definition
      Returns:
      a builder for the request to get a process definition
    • newProcessDefinitionGetXmlRequest

      public ProcessDefinitionGetXmlRequest newProcessDefinitionGetXmlRequest(long processDefinitionKey)
      Specified by:
      newProcessDefinitionGetXmlRequest in interface CamundaClient
    • newProcessDefinitionGetFormRequest

      public ProcessDefinitionGetFormRequest newProcessDefinitionGetFormRequest(long processDefinitionKey)
      Specified by:
      newProcessDefinitionGetFormRequest in interface CamundaClient
    • newProcessDefinitionQuery

      public ProcessDefinitionQuery newProcessDefinitionQuery()
      Description copied from interface: CamundaClient
      Executes a search request to query process definitions.
       long processDefinitionKey = ...;
      
       camundaClient
        .newProcessDefinitionQuery()
        .filter((f) -> f.processDefinitionKey(processDefinitionKey))
        .sort((s) -> s.name().asc())
        .page((p) -> p.limit(100))
        .send();
       
      Specified by:
      newProcessDefinitionQuery in interface CamundaClient
      Returns:
      a builder for the process definition query
    • newProcessInstanceGetRequest

      public ProcessInstanceGetRequest newProcessInstanceGetRequest(long processInstanceKey)
      Description copied from interface: CamundaClient
      Retrieves a process instance by key.
       long processInstanceKey = ...;
      
       camundaClient
        .newProcessInstanceGetRequest(processInstanceKey)
        .send();
       
      Specified by:
      newProcessInstanceGetRequest in interface CamundaClient
      Returns:
      a builder for the request to get a process instance
    • newProcessInstanceQuery

      public ProcessInstanceQuery newProcessInstanceQuery()
      Description copied from interface: CamundaClient
      Executes a search request to query process instances.
       long processInstanceKey = ...;
      
       camundaClient
        .newProcessInstanceQuery()
        .filter((f) -> f.processInstanceKeys(processInstanceKey))
        .sort((s) -> s.startDate().asc())
        .page((p) -> p.limit(100))
        .send();
       
      Specified by:
      newProcessInstanceQuery in interface CamundaClient
      Returns:
      a builder for the process instance query
    • newFlownodeInstanceQuery

      public FlownodeInstanceQuery newFlownodeInstanceQuery()
      Description copied from interface: CamundaClient
      Executes a search request to query flow node instances.
       long flownodeInstanceKey = ...;
      
       camundaClient
        .newFlownodeInstanceQuery()
        .filter((f) -> f.processInstanceKeys(processInstanceKey))
        .sort((s) -> s.flowNodeName().asc())
        .page((p) -> p.limit(100))
        .send();
       
      Specified by:
      newFlownodeInstanceQuery in interface CamundaClient
      Returns:
      a builder for the process instance query
    • newFlowNodeInstanceGetRequest

      public FlowNodeInstanceGetRequest newFlowNodeInstanceGetRequest(long flowNodeInstanceKey)
      Description copied from interface: CamundaClient
      Gets a flow node instance by key.
         long flowNodeInstanceKey = ...;
      
         camundaClient
         .newFlowNodeInstanceGetRequest(flowNodeInstanceKey)
         .send();
         
      Specified by:
      newFlowNodeInstanceGetRequest in interface CamundaClient
      Parameters:
      flowNodeInstanceKey - the key of the flow node instance
      Returns:
      a builder for the request to get a flow node instance
    • newUserTaskQuery

      public UserTaskQuery newUserTaskQuery()
      Description copied from interface: CamundaClient
      Executes a search request to query user tasks.
       camundaClient
        .newUserTaskQuery()
        .filter((f) -> f.userTaskKey(userTaskKey))
        .sort((s) -> s.creationDate().asc())
        .page((p) -> p.limit(100))
        .send();
       
      Specified by:
      newUserTaskQuery in interface CamundaClient
      Returns:
      a builder for the user task query
    • newDecisionRequirementsQuery

      public DecisionRequirementsQuery newDecisionRequirementsQuery()
      Description copied from interface: CamundaClient
      Executes a search request to query Decision Requirements.
         camundaClient
         .newDecisionRequirementsQuery()
         .filter((f) -> f.decisionRequirementsKey(decisionRequirementsKey))
         .sort((s) -> s.version().asc())
         .page((p) -> p.limit(100))
         .send();
         
      Specified by:
      newDecisionRequirementsQuery in interface CamundaClient
      Returns:
      a builder for the decision requirements query
    • newDecisionDefinitionQuery

      public DecisionDefinitionQuery newDecisionDefinitionQuery()
      Specified by:
      newDecisionDefinitionQuery in interface CamundaClient
    • newDecisionDefinitionGetRequest

      public DecisionDefinitionGetRequest newDecisionDefinitionGetRequest(long decisionDefinitionKey)
      Description copied from interface: CamundaClient
      Gets a decision definition by key.
         long decisionDefinitionKey = ...;
      
         camundaClient
         .newDecisionDefinitionGetRequest(decisionDefinitionKey)
         .send();
         
      Specified by:
      newDecisionDefinitionGetRequest in interface CamundaClient
      Parameters:
      decisionDefinitionKey - the key of the decision definition
      Returns:
      a builder for the request to get a decision definition
    • newDecisionDefinitionGetXmlRequest

      public DecisionDefinitionGetXmlRequest newDecisionDefinitionGetXmlRequest(long decisionKey)
      Specified by:
      newDecisionDefinitionGetXmlRequest in interface CamundaClient
    • newDecisionInstanceQuery

      public DecisionInstanceQuery newDecisionInstanceQuery()
      Description copied from interface: CamundaClient
      Executes a search request to query decision instances.
       long decisionInstanceKey = ...;
      
       camundaClient
        .newDecisionInstanceQuery()
        .filter((f) -> f.decisionInstanceKey(decisionInstanceKey))
        .sort((s) -> s.decisionInstanceKey().asc())
        .page((p) -> p.limit(100))
        .send();
       
      Specified by:
      newDecisionInstanceQuery in interface CamundaClient
      Returns:
      a builder for the decision instance query
    • newDecisionInstanceGetRequest

      public DecisionInstanceGetRequest newDecisionInstanceGetRequest(String decisionInstanceId)
      Description copied from interface: CamundaClient
      Retrieves a decision instance by id.
       String decisionInstanceId = ...;
      
       camundaClient
       .newDecisionInstanceGetQuery(decisionInstanceId)
       .send();
       
      Specified by:
      newDecisionInstanceGetRequest in interface CamundaClient
      Parameters:
      decisionInstanceId - the id of the decision instance to fetch
      Returns:
      a builder for the request to get a decision instance
    • newIncidentQuery

      public IncidentQuery newIncidentQuery()
      Specified by:
      newIncidentQuery in interface CamundaClient
    • newIncidentGetRequest

      public IncidentGetRequest newIncidentGetRequest(long incidentKey)
      Description copied from interface: CamundaClient
      Gets an incident by key.
         long incidentKey = ...;
      
         camundaClient
         .newIncidentGetRequest(incidentKey)
         .send();
         
      Specified by:
      newIncidentGetRequest in interface CamundaClient
      Parameters:
      incidentKey - the key of the incident
      Returns:
      a builder for the request to get an incident
    • newCreateRoleCommand

      public CreateRoleCommandStep1 newCreateRoleCommand()
      Description copied from interface: CamundaClient
      Command to create a role.
      
      
       camundaClient
        .newRoleCreateCommand()
        .name(name)
        .send();
       

      This command is only sent via REST over HTTP, not via gRPC

      Specified by:
      newCreateRoleCommand in interface CamundaClient
      Returns:
      a builder for the command
    • newCreateGroupCommand

      public CreateGroupCommandStep1 newCreateGroupCommand()
      Description copied from interface: CamundaClient
      Command to create a group.
      
      
       camundaClient
        .newCreateGroupCommand()
        .name(name)
        .send();
       

      This command is only sent via REST over HTTP, not via gRPC

      Specified by:
      newCreateGroupCommand in interface CamundaClient
      Returns:
      a builder for the command
    • newUpdateGroupCommand

      public UpdateGroupCommandStep1 newUpdateGroupCommand(long groupKey)
      Description copied from interface: CamundaClient
      Command to update a group.
      
      
       camundaClient
        .newUpdateGroupCommand(123L)
        .name(name)
        .send();
       

      This command is only sent via REST over HTTP, not via gRPC

      Specified by:
      newUpdateGroupCommand in interface CamundaClient
      Returns:
      a builder for the command
    • newDeleteGroupCommand

      public DeleteGroupCommandStep1 newDeleteGroupCommand(long groupKey)
      Description copied from interface: CamundaClient
      Command to delete a group.
      
      
       camundaClient
        .newDeleteGroupCommand(123L)
        .send();
       

      This command is only sent via REST over HTTP, not via gRPC

      Specified by:
      newDeleteGroupCommand in interface CamundaClient
      Returns:
      a builder for the command
    • newAssignUserToGroupCommand

      public AssignUserToGroupCommandStep1 newAssignUserToGroupCommand(long groupKey)
      Description copied from interface: CamundaClient
      Command to assign a user to a group.
      
      
       camundaClient
        .newAssignUserToGroupCommand(123L)
        .userKey(456L)
        .send();
       

      This command is only sent via REST over HTTP, not via gRPC

      Specified by:
      newAssignUserToGroupCommand in interface CamundaClient
      Returns:
      a builder for the command
    • newUnassignUserFromGroupCommand

      public UnassignUserFromGroupCommandStep1 newUnassignUserFromGroupCommand(long groupKey)
      Description copied from interface: CamundaClient
      Command to unassign a user from a group.
      
      
       camundaClient
        .newUnassignUserFromGroupCommand(123L)
        .userKey(456L)
        .send();
       

      This command is only sent via REST over HTTP, not via gRPC

      Specified by:
      newUnassignUserFromGroupCommand in interface CamundaClient
      Returns:
      a builder for the command
    • newUserCreateCommand

      public CreateUserCommandStep1 newUserCreateCommand()
      Description copied from interface: CamundaClient
      Command to create a user.
      
      
       camundaClient
        .newUserCreateCommand()
        .username(username)
        .email(email)
        .name(name)
        .password(password)
        .send();
       

      This command is only sent via REST over HTTP, not via gRPC

      Specified by:
      newUserCreateCommand in interface CamundaClient
      Returns:
      a builder for the command
    • newCreateMappingCommand

      public CreateMappingCommandStep1 newCreateMappingCommand()
      Description copied from interface: CamundaClient
      Command to create a mapping rule.
       camundaClient
        .newCreateMappingCommand()
        .claimName(claimName)
        .claimValue(claimValue)
        .name(name)
        .send();
       

      This command is only sent via REST over HTTP, not via gRPC

      Specified by:
      newCreateMappingCommand in interface CamundaClient
      Returns:
      a builder for the command
    • newDecisionRequirementsGetXmlRequest

      public DecisionRequirementsGetXmlRequest newDecisionRequirementsGetXmlRequest(long decisionRequirementsKey)
      Specified by:
      newDecisionRequirementsGetXmlRequest in interface CamundaClient
    • newDecisionRequirementsGetRequest

      public DecisionRequirementsGetRequest newDecisionRequirementsGetRequest(long decisionRequirementsKey)
      Description copied from interface: CamundaClient
      Gets a decision requirements by key.
         long decisionRequirementsKey = ...;
      
         camundaClient
         .newDecisionRequirementsGetRequest(decisionRequirementsKey)
         .send();
         
      Specified by:
      newDecisionRequirementsGetRequest in interface CamundaClient
      Parameters:
      decisionRequirementsKey - the key of the decision requirements
      Returns:
      a builder for the request to get a decision requirements
    • newUserTaskGetFormRequest

      public UserTaskGetFormRequest newUserTaskGetFormRequest(long userTaskKey)
      Description copied from interface: CamundaClient
      Gets a user task form by key.
         long userTaskKey = ...;
      
         camundaClient
         .newUserTaskGetFormRequest(userTaskKey)
         .send();
         
      Specified by:
      newUserTaskGetFormRequest in interface CamundaClient
      Parameters:
      userTaskKey - the key of the user task
      Returns:
      a builder for the request to get a user task form
    • newUserTaskGetRequest

      public UserTaskGetRequest newUserTaskGetRequest(long userTaskKey)
      Description copied from interface: CamundaClient
      Gets a User Task by key.
         long userTaskKey = ...;
      
         camundaClient
         .newUserTaskGetRequest(userTaskKey)
         .send();
         
      Specified by:
      newUserTaskGetRequest in interface CamundaClient
      Parameters:
      userTaskKey - the key of the user task
      Returns:
      a builder for the request to get a user task
    • newVariableQuery

      public VariableQuery newVariableQuery()
      Description copied from interface: CamundaClient
      Executes a search request to query variables.
       camundaClient
        .newVariableQuery()
        .filter((f) -> f.variableKey(variableKey))
        .sort((s) -> s.value().asc())
        .page((p) -> p.limit(100))
        .send();
      Specified by:
      newVariableQuery in interface CamundaClient
      Returns:
      a builder for the variable query
    • newVariableGetRequest

      public VariableGetRequest newVariableGetRequest(long variableKey)
      Description copied from interface: CamundaClient
      Gets a variable by key.
         long variableKey = ...;
      
        camundaClient
       .newVariableGetRequest(variableKey)
       .send();
      Specified by:
      newVariableGetRequest in interface CamundaClient
      Parameters:
      variableKey - the key of the variable
      Returns:
      a builder for the request to get a variable
    • newUserTaskVariableQuery

      public UserTaskVariableQuery newUserTaskVariableQuery(long userTaskKey)
      Description copied from interface: CamundaClient
      Gets a variabes associated to a User Task key.
         long variableKey = ...;
      
        camundaClient
       .newUserTaskVariableQuery(variableKey)
        .sort((s) -> s.value().asc())
        .page((p) -> p.limit(100))
       .send();
      Specified by:
      newUserTaskVariableQuery in interface CamundaClient
      Parameters:
      userTaskKey - the key of the user task
      Returns:
      a builder for the request to get the variables
    • newCreateDocumentCommand

      public CreateDocumentCommandStep1 newCreateDocumentCommand()
      Description copied from interface: CamundaClient
      Experimental: This method is under development. The respective API on compatible clusters cannot be considered production-ready. Thus, this method doesn't work out of the box with all clusters. Until this warning is removed, anything described below may not yet have taken effect, and the interface and its description are subject to change.

      Command to create a document.

         camundaClient
         .newCreateDocumentCommand()
         .content(inputStream)
         .fileName("file.txt")
         .timeToLive(Duration.ofDays(1))
         .send();
         
      Specified by:
      newCreateDocumentCommand in interface CamundaClient
      Returns:
      a builder for the command
    • newCreateDocumentBatchCommand

      public CreateDocumentBatchCommandStep1 newCreateDocumentBatchCommand()
      Description copied from interface: CamundaClient
      Experimental: This method is under development. The respective API on compatible clusters cannot be considered production-ready. Thus, this method doesn't work out of the box with all clusters. Until this warning is removed, anything described below may not yet have taken effect, and the interface and its description are subject to change.

      Command to create a batch of documents. Unlike CamundaClient.newCreateDocumentCommand(), this command allows you to create multiple documents in a single request. This can be more efficient than creating each document individually, however, there are multiple limitations to consider.

      Limitations:

      • The gateway does not guarantee the atomicity of the batch operation. If the gateway receives the batch but fails to create one or more documents, it will not roll back the operation. This means that some documents may be created while others are not. The client should handle this scenario by checking the response for each document.
      • Each document in the batch must have a unique name.
      • It is not possible to assign a custom document ID to the documents in the batch. The document ID will be generated by the broker.
      • The total size of the batch must not exceed the multipart request size limit of the gateway.
      • The documents can only be created in a single store. If you need to create documents in multiple stores, you must create separate batches for each store.

         zeebeClient
         .newCreateDocumentBatchCommand()
         .addDocument()
         .content(inputStream1)
         .fileName("file1.txt")
         .timeToLive(Duration.ofDays(1))
         .done()
         .addDocument()
         .content(inputStream2)
         .fileName("file2.txt")
         .timeToLive(Duration.ofDays(1))
         .done()
         
      Specified by:
      newCreateDocumentBatchCommand in interface CamundaClient
      Returns:
      a builder for the command
    • newDocumentContentGetRequest

      public DocumentContentGetRequest newDocumentContentGetRequest(String documentId)
      Description copied from interface: CamundaClient
      Experimental: This method is under development. The respective API on compatible clusters cannot be considered production-ready. Thus, this method doesn't work out of the box with all clusters. Until this warning is removed, anything described below may not yet have taken effect, and the interface and its description are subject to change.

      Command to get a document.

         camundaClient
         .newDocumentContentGetRequest(documentId)
         .storeId(storeId)
         .send();
         
      Specified by:
      newDocumentContentGetRequest in interface CamundaClient
      Parameters:
      documentId - the id of the document
      Returns:
      a builder for the request
    • newDocumentContentGetRequest

      public DocumentContentGetRequest newDocumentContentGetRequest(DocumentReferenceResponse documentReference)
      Description copied from interface: CamundaClient
      Experimental: This method is under development. The respective API on compatible clusters cannot be considered production-ready. Thus, this method doesn't work out of the box with all clusters. Until this warning is removed, anything described below may not yet have taken effect, and the interface and its description are subject to change.

      Command to get a document.

         camundaClient
         .newDocumentContentGetRequest(documentReferenceResponse)
         .send();
         
      Specified by:
      newDocumentContentGetRequest in interface CamundaClient
      Parameters:
      documentReference - the reference of the document
      Returns:
      a builder for the request
    • newCreateDocumentLinkCommand

      public CreateDocumentLinkCommandStep1 newCreateDocumentLinkCommand(String documentId)
      Description copied from interface: CamundaClient
      Experimental: This method is under development. The respective API on compatible clusters cannot be considered production-ready. Thus, this method doesn't work out of the box with all clusters. Until this warning is removed, anything described below may not yet have taken effect, and the interface and its description are subject to change.

      Command to update a document.

         camundaClient
         .newCreateDocumentLinkCommand(documentId)
         .storeId(storeId)
         .timeToLive(Duration.ofHours(1))
         .send();
         
      Specified by:
      newCreateDocumentLinkCommand in interface CamundaClient
      Parameters:
      documentId - the id of the document
      Returns:
      a builder for the command
    • newCreateDocumentLinkCommand

      public CreateDocumentLinkCommandStep1 newCreateDocumentLinkCommand(DocumentReferenceResponse documentReference)
      Description copied from interface: CamundaClient
      Experimental: This method is under development. The respective API on compatible clusters cannot be considered production-ready. Thus, this method doesn't work out of the box with all clusters. Until this warning is removed, anything described below may not yet have taken effect, and the interface and its description are subject to change.

      Command to update a document.

         camundaClient
         .newCreateDocumentLinkCommand(documentReferenceResponse)
         .timeToLive(Duration.ofHours(1))
         .send();
         
      Specified by:
      newCreateDocumentLinkCommand in interface CamundaClient
      Parameters:
      documentReference - the reference of the document
      Returns:
      a builder for the command
    • newDeleteDocumentCommand

      public DeleteDocumentCommandStep1 newDeleteDocumentCommand(String documentId)
      Description copied from interface: CamundaClient
      Experimental: This method is under development. The respective API on compatible clusters cannot be considered production-ready. Thus, this method doesn't work out of the box with all clusters. Until this warning is removed, anything described below may not yet have taken effect, and the interface and its description are subject to change.

      Command to update a document.

         camundaClient
         .newDeleteDocumentCommand(documentId)
         .storeId(storeId)
         .send();
         
      Specified by:
      newDeleteDocumentCommand in interface CamundaClient
      Parameters:
      documentId - the id of the document
      Returns:
      a builder for the command
    • newDeleteDocumentCommand

      public DeleteDocumentCommandStep1 newDeleteDocumentCommand(DocumentReferenceResponse documentReference)
      Description copied from interface: CamundaClient
      Experimental: This method is under development. The respective API on compatible clusters cannot be considered production-ready. Thus, this method doesn't work out of the box with all clusters. Until this warning is removed, anything described below may not yet have taken effect, and the interface and its description are subject to change.

      Command to update a document.

         camundaClient
         .newDeleteDocumentCommand(documentReferenceResponse)
         .send();
         
      Specified by:
      newDeleteDocumentCommand in interface CamundaClient
      Parameters:
      documentReference - the reference of the document
      Returns:
      a builder for the command
    • newCreateTenantCommand

      public CreateTenantCommandStep1 newCreateTenantCommand()
      Description copied from interface: CamundaClient
      Command to create a tenant.
       camundaClient
        .newCreateTenantCommand()
        .tenantId("tenant-id")
        .name("Tenant Name")
        .send();
       
      Specified by:
      newCreateTenantCommand in interface CamundaClient
      Returns:
      a builder for the command
    • newUpdateTenantCommand

      public UpdateTenantCommandStep1 newUpdateTenantCommand(String tenantId)
      Description copied from interface: CamundaClient
      Creates a command to update the name of an existing tenant.

      Example usage:

       camundaClient
         .newUpdateTenantCommand("my-tenant-id") // Specify the tenant id
         .name("Updated Tenant Name")   // Set the new tenant name
         .send();                       // Send the command to the broker
       
      Specified by:
      newUpdateTenantCommand in interface CamundaClient
      Parameters:
      tenantId - the unique identifier of the tenant to be updated
      Returns:
      a builder to configure and send the update tenant command
    • newDeleteTenantCommand

      public DeleteTenantCommandStep1 newDeleteTenantCommand(String tenantId)
      Description copied from interface: CamundaClient
      Command to delete a tenant.
       camundaClient
        .newDeleteTenantCommand(tenantKey)
        .send();
       
      Specified by:
      newDeleteTenantCommand in interface CamundaClient
      Parameters:
      tenantId - the id of the tenant to delete
      Returns:
      a builder for the delete tenant command
    • newAssignMappingToTenantCommand

      public AssignMappingToTenantCommandStep1 newAssignMappingToTenantCommand(long tenantKey)
      Description copied from interface: CamundaClient
      Command to assign a mapping rule to a tenant.

      Example usage:

       camundaClient
         .newAssignMappingToTenantCommand(tenantKey)
         .mappingKey(mappingKey)
         .send();
       

      This command sends an HTTP PUT request to assign the specified mapping rule to the given tenant.

      Specified by:
      newAssignMappingToTenantCommand in interface CamundaClient
      Parameters:
      tenantKey - the unique identifier of the tenant
      Returns:
      a builder for the assign mapping rule to tenant command
    • newAssignUserToTenantCommand

      public AssignUserToTenantCommandStep1 newAssignUserToTenantCommand(String tenantId)
      Description copied from interface: CamundaClient
      Command to assign a user to a tenant.

      Example usage:

       camundaClient
         .newAssignUserToTenantCommand(tenantId)
         .username(username)
         .send();
       

      This command sends an HTTP PUT request to assign the specified user to the given tenant.

      Specified by:
      newAssignUserToTenantCommand in interface CamundaClient
      Parameters:
      tenantId - the unique identifier of the tenant
      Returns:
      a builder for the assign user to tenant command
    • newAssignGroupToTenantCommand

      public AssignGroupToTenantCommandStep1 newAssignGroupToTenantCommand(long tenantKey)
      Description copied from interface: CamundaClient
      Command to assign a group to a tenant.

      Example usage:

       camundaClient
         .newAssignGroupToTenantCommand(tenantKey)
         .groupKey(groupKey)
         .send();
       
      Specified by:
      newAssignGroupToTenantCommand in interface CamundaClient
      Parameters:
      tenantKey - the unique identifier of the tenant
      Returns:
      a builder to configure and send the assign group to tenant command
    • newUnassignGroupFromTenantCommand

      public UnassignGroupFromTenantCommandStep1 newUnassignGroupFromTenantCommand(long tenantKey)
      Description copied from interface: CamundaClient
      Command to unassign a group from a tenant.

      Example usage:

       camundaClient
         .newUnassignGroupFromTenantCommand(tenantKey)
         .groupKey(groupKey)
         .send();
       
      Specified by:
      newUnassignGroupFromTenantCommand in interface CamundaClient
      Parameters:
      tenantKey - the unique identifier of the tenant
      Returns:
      a builder to configure and send the unassign group from tenant command
    • newCreateAuthorizationCommand

      public CreateAuthorizationCommandStep1 newCreateAuthorizationCommand()
      Description copied from interface: CamundaClient
      Command to create an authorization

      Example usage:

       camundaClient
         .newCreateAuthorizationCommand(tenantKey)
         .ownerId(ownerId)
         .ownerType(ownerType)
         .resourceId(resourceId)
         .resourceType(resourceType)
         .permission(PermissionType.READ)
         .send();
       
      Specified by:
      newCreateAuthorizationCommand in interface CamundaClient
      Returns:
      a builder to configure and send the create authorization command
    • newDeleteAuthorizationCommand

      public DeleteAuthorizationCommandStep1 newDeleteAuthorizationCommand(long authorizationKey)
      Description copied from interface: CamundaClient
      Command to delete an authorization

      Example usage:

       camundaClient
         .newDeleteAuthorizationCommand(authorizationKey)
         .send();
       
      Specified by:
      newDeleteAuthorizationCommand in interface CamundaClient
      Parameters:
      authorizationKey - the key of the authorization to delete
      Returns:
      a builder to configure and send the delete authorization command
    • newUpdateAuthorizationCommand

      public UpdateAuthorizationCommandStep1 newUpdateAuthorizationCommand(long authorizationKey)
      Description copied from interface: CamundaClient
      Command to update an authorization

      Example usage:

       camundaClient
         .newUpdateAuthorizationCommand(authorizationKey)
         .ownerId(ownerId)
         .ownerType(ownerType)
         .resourceId(resourceId)
         .resourceType(resourceType)
         .permissionTypes(Set.of(PermissionType.READ))
         .send();
       
      Specified by:
      newUpdateAuthorizationCommand in interface CamundaClient
      Parameters:
      authorizationKey - the key of the authorization to update
      Returns:
      a builder to configure and send the update authorization command
    • newRemoveUserFromTenantCommand

      public RemoveUserFromTenantCommandStep1 newRemoveUserFromTenantCommand(String tenantId)
      Description copied from interface: CamundaClient
      Command to remove a user from a tenant.

      Example usage:

       camundaClient
         .newRemoveUserFromTenantCommand(tenantId)
         .username(username)
         .send();
       

      This command sends an HTTP DELETE request to remove the specified user from the given tenant.

      Specified by:
      newRemoveUserFromTenantCommand in interface CamundaClient
      Parameters:
      tenantId - the unique identifier of the tenant
      Returns:
      a builder for the remove user from tenant command
    • newCompleteCommand

      public CompleteJobCommandStep1 newCompleteCommand(long jobKey)
      Description copied from interface: JobClient
      Command to complete a job.
       long jobKey = ..;
      
       jobClient
        .newCompleteCommand(jobKey)
        .variables(json)
        .send();
       

      If the job is linked to a process instance then this command will complete the related activity and continue the flow.

      Specified by:
      newCompleteCommand in interface JobClient
      Parameters:
      jobKey - the key which identifies the job
      Returns:
      a builder for the command
    • newCompleteCommand

      public CompleteJobCommandStep1 newCompleteCommand(ActivatedJob job)
      Description copied from interface: JobClient
      Command to complete a job.
       ActivatedJob job = ..;
      
       jobClient
        .newCompleteCommand(job)
        .variables(json)
        .send();
       

      If the job is linked to a process instance then this command will complete the related activity and continue the flow.

      Specified by:
      newCompleteCommand in interface JobClient
      Parameters:
      job - the activated job
      Returns:
      a builder for the command
    • newFailCommand

      public FailJobCommandStep1 newFailCommand(long jobKey)
      Description copied from interface: JobClient
      Command to mark a job as failed.
       long jobKey = ..;
      
       jobClient
        .newFailCommand(jobKey)
        .retries(3)
        .send();
       

      If the given retries are greater than zero then this job will be picked up again by a job subscription. Otherwise, an incident is created for this job.

      Specified by:
      newFailCommand in interface JobClient
      Parameters:
      jobKey - the key which identifies the job
      Returns:
      a builder for the command
    • newFailCommand

      public FailJobCommandStep1 newFailCommand(ActivatedJob job)
      Description copied from interface: JobClient
      Command to mark a job as failed.
       ActivatedJob job = ..;
      
       jobClient
        .newFailCommand(job)
        .retries(3)
        .send();
       

      If the given retries are greater than zero then this job will be picked up again by a job subscription. Otherwise, an incident is created for this job.

      Specified by:
      newFailCommand in interface JobClient
      Parameters:
      job - the activated job
      Returns:
      a builder for the command
    • newThrowErrorCommand

      public ThrowErrorCommandStep1 newThrowErrorCommand(long jobKey)
      Description copied from interface: JobClient
      Command to report a business error (i.e. non-technical) that occurs while processing a job.
       long jobKey = ...;
       String code = ...;
      
       jobClient
        .newThrowErrorCommand(jobKey)
        .errorCode(code)
        .send();
       

      The error is handled in the process by an error catch event. If there is no error catch event with the specified errorCode then an incident will be raised instead.

      Specified by:
      newThrowErrorCommand in interface JobClient
      Parameters:
      jobKey - the key which identifies the job
      Returns:
      a builder for the command
    • newThrowErrorCommand

      public ThrowErrorCommandStep1 newThrowErrorCommand(ActivatedJob job)
      Description copied from interface: JobClient
      Command to report a business error (i.e. non-technical) that occurs while processing a job.
       ActivatedJob job = ...;
       String code = ...;
      
       jobClient
        .newThrowErrorCommand(job)
        .errorCode(code)
        .send();
       

      The error is handled in the process by an error catch event. If there is no error catch event with the specified errorCode then an incident will be raised instead.

      Specified by:
      newThrowErrorCommand in interface JobClient
      Parameters:
      job - the activated job
      Returns:
      a builder for the command
    • newActivateJobsCommand

      public ActivateJobsCommandStep1 newActivateJobsCommand()
      Description copied from interface: JobClient
      Command to activate multiple jobs of a given type.
       jobClient
        .newActivateJobsCommand()
        .jobType("payment")
        .maxJobsToActivate(10)
        .workerName("paymentWorker")
        .timeout(Duration.ofMinutes(10))
        .send();
       

      The command will try to use maxJobsToActivate for given jobType. If less then the requested maxJobsToActivate jobs of the jobType are available for activation the returned list will have fewer elements.

      Specified by:
      newActivateJobsCommand in interface JobClient
      Returns:
      a builder for the command
    • newStreamJobsCommand

      public StreamJobsCommandStep1 newStreamJobsCommand()
      Description copied from interface: JobClient
      Activates and streams jobs of a specific type.
      
       final Consumer<ActivatedJob> consumer = ...; // do something with the consumed job
       final CamundaFuture<StreamJobsResponse> stream = jobClient
        .newStreamJobsCommand()
        .jobType("payment")
        .consumer(consumer)
        .workerName("paymentWorker")
        .timeout(Duration.ofMinutes(10))
        .send();
      
        stream.whenComplete((ok, error) -> {
          // recreate stream if necessary
          // be careful if you've cancelled the stream explicitly to not recreate it if shutting down
        });
      
        // You can later terminate the stream by cancelling the future
        stream.cancel(true);
       

      Stream or Activate?

      As opposed to JobClient.newActivateJobsCommand(), which polls each partition until it has activated enough jobs or a timeout has elapsed, this command opens a long living stream onto which activated jobs are pushed. This typically results in lower latency, as jobs are activated and pushed out immediately, instead of waiting to be polled.

      Limitations

      This feature is still under development; as such, there is currently no way to rate limit how many jobs are streamed over a single call. This can be mitigated by opening more streams of the same type, which will ensure work is fairly load balanced.

      Additionally, only jobs which are created, retried, or timed out after the command has been registered will be streamed out. For older jobs, you must still use the JobClient.newActivateJobsCommand(). It's generally recommended that you use the JobWorker API to avoid having to coordinate both calls.

      Activation

      Jobs activated via this command will use the given worker name, activation time out, and fetch variables parameters in the same way as the JobClient.newActivateJobsCommand().

      Termination

      The stream can be explicitly cancelled by performing one of the following:

      • Closing the Camunda client
      • Cancelling the result of FinalCommandStep.send() via Future.cancel(boolean) (the argument is irrelevant)
      • Setting a FinalCommandStep.requestTimeout(Duration); the stream will be closed once this time out is reached. By default, there is no request time out at all. It's recommended to assign a long-ish time out and recreate your streams from time to time to ensure good load balancing across gateways.
      NOTE: streams can be closed for various reasons - for example, the server is restarting. As such, it's recommended to add listeners to the resulting future to handle such cases and reopen streams if necessary.
      Specified by:
      newStreamJobsCommand in interface JobClient
      Returns:
      a builder for the command