Class CompleteJobCommandImpl
- All Implemented Interfaces:
CommandWithCommunicationApiStep<CompleteJobCommandStep1>,CommandWithVariables<CompleteJobCommandStep1>,CompleteJobCommandStep1,CompleteJobCommandStep1.CompleteJobCommandJobResultStep,FinalCommandStep<CompleteJobResponse>,JobCallbackFinalCommandStep<CompleteJobResponse>
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.camunda.client.api.command.CompleteJobCommandStep1
CompleteJobCommandStep1.CompleteJobCommandJobResultStep -
Field Summary
Fields inherited from class io.camunda.client.impl.command.CommandWithVariables
objectMapper -
Constructor Summary
ConstructorsConstructorDescriptionCompleteJobCommandImpl(io.camunda.zeebe.gateway.protocol.GatewayGrpc.GatewayStub asyncStub, JsonMapper jsonMapper, long key, Duration requestTimeout, Predicate<CredentialsProvider.StatusCode> retryPredicate, HttpClient httpClient, boolean preferRestOverGrpc) -
Method Summary
Modifier and TypeMethodDescriptionInitialized the job result to allow activation of elements in an ad-hoc sub process.Initializes the job result to allow corrections or a denial to be configured.requestTimeout(Duration requestTimeout) Sets the request timeout for the command.send()Sends the command to the Camunda gateway.protected CompleteJobCommandStep1setVariablesInternal(String variables) useGrpc()Sets gRPC as the communication API for this command.useRest()Sets REST as the communication API for this command.withBusinessId(String businessId) Assigns the given business id to the job's root process instance as part of completing the job, letting a worker derive the identifier from work it just performed.withLeaseToken(String leaseToken) Sets the lease token identifying the job's activation, fencing this command against a superseded activation of the same job.withResult(Function<CompleteJobCommandStep1.CompleteJobCommandJobResultStep, CompleteJobResult> function) Initializes the job result to allow followup actions to be configured.Methods inherited from class io.camunda.client.impl.command.CommandWithVariables
variable, variables, variables, variables, variablesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.camunda.client.api.command.CompleteJobCommandStep1
variable, variables, variables, variables, variablesMethods inherited from interface io.camunda.client.api.command.FinalCommandStep
execute
-
Constructor Details
-
CompleteJobCommandImpl
public CompleteJobCommandImpl(io.camunda.zeebe.gateway.protocol.GatewayGrpc.GatewayStub asyncStub, JsonMapper jsonMapper, long key, Duration requestTimeout, Predicate<CredentialsProvider.StatusCode> retryPredicate, HttpClient httpClient, boolean preferRestOverGrpc)
-
-
Method Details
-
requestTimeout
Description copied from interface:FinalCommandStepSets the request timeout for the command. The default request timeout can be configured usingCamundaClientBuilder.defaultRequestTimeout(Duration).- Specified by:
requestTimeoutin interfaceFinalCommandStep<CompleteJobResponse>- Parameters:
requestTimeout- the request timeout- Returns:
- the configured command
-
send
Description copied from interface:FinalCommandStepSends the command to the Camunda gateway. This operation is asynchronous. In case of success, the future returns the event that was generated by the Camunda gateway in response to the command.Call
CamundaFuture.join()to wait until the response is available.Future<JobEventinvalid input: '>' future = command.send(); JobEvent event = future.join();- Specified by:
sendin interfaceFinalCommandStep<CompleteJobResponse>- Returns:
- a future tracking state of success/failure of the command.
-
withResult
public CompleteJobCommandStep1 withResult(Function<CompleteJobCommandStep1.CompleteJobCommandJobResultStep, CompleteJobResult> function) Description copied from interface:CompleteJobCommandStep1Initializes the job result to allow followup actions to be configured.- Specified by:
withResultin interfaceCompleteJobCommandStep1- Returns:
- the builder for this command.
-
withLeaseToken
Description copied from interface:CompleteJobCommandStep1Sets the lease token identifying the job's activation, fencing this command against a superseded activation of the same job. Obtain it fromActivatedJob#getLeaseToken().For a leased job, the matching token must be supplied to prove the command comes from the worker that holds the current lease; a command with no token is rejected. A command carrying a stale token is likewise rejected, fencing the job against a superseded activation (e.g. after the job timed out or failed and was re-activated by another worker). A job that was activated without a lease requires no token.
When this command is created from an activated job (e.g.
newCompleteCommand(activatedJob)) the job's lease token is carried automatically, so this method is only needed when building the command from a job key.- Specified by:
withLeaseTokenin interfaceCompleteJobCommandStep1- Parameters:
leaseToken- the opaque lease token the worker received when the job was activated- Returns:
- the builder for this command. Call
FinalCommandStep.send()to complete the command and send it to the broker.
-
withBusinessId
Description copied from interface:CompleteJobCommandStep1Assigns the given business id to the job's root process instance as part of completing the job, letting a worker derive the identifier from work it just performed.The assignment is single and irreversible and is only accepted while business id uniqueness is disabled. Only artifacts created after the assignment carry the business id; already-existing ones are not enriched. Completing with a business id that differs from one already assigned rejects the whole completion, leaving the job open; re-sending the identical business id is an idempotent no-op.
Passing
nullleaves the business id unset (no assignment is requested). A blank business id is rejected with anIllegalArgumentException.- Specified by:
withBusinessIdin interfaceCompleteJobCommandStep1- Parameters:
businessId- the business id to assign to the root process instance- Returns:
- the builder for this command. Call
FinalCommandStep.send()to complete the command and send it to the broker.
-
forUserTask
Description copied from interface:CompleteJobCommandStep1.CompleteJobCommandJobResultStepInitializes the job result to allow corrections or a denial to be configured.This method is used to apply changes to user task attributes (such as
assignee,priority,dueDate, and so on) or explicitly deny a user task lifecycle transition.Example usage:
client.newCompleteJobCommand(jobKey) .withResult(r -> r.forUserTask() .correctAssignee("john_doe") // dynamically reassigns the task to 'john_doe' .correctPriority(84) // adjusts the priority of the task .correctDueDate("2024-11-22T11:44:55.0000Z")) // sets a new due date .send();- Specified by:
forUserTaskin interfaceCompleteJobCommandStep1.CompleteJobCommandJobResultStep- Returns:
- the builder for this command.
-
forAdHocSubProcess
Description copied from interface:CompleteJobCommandStep1.CompleteJobCommandJobResultStepInitialized the job result to allow activation of elements in an ad-hoc sub process.This method is used to activate elements as a followup of a job completion. It will activate elements by id and variables provided will be created in the scope of the created element.
client.newCompleteJobCommand(jobKey) .withResult(r -> r.forAdHocSubProcess() .activateElement("elementId") // Activate the element with id 'elementId' .variable("key", "value") // Create variable in the scope of 'elementId' .activateElement("anotherElementId")) // Activate another element with id 'anotherElementId' .variable("key", "value") // Create a variable in the scope of 'anotherElementId' .send();- Specified by:
forAdHocSubProcessin interfaceCompleteJobCommandStep1.CompleteJobCommandJobResultStep- Returns:
- the builder for this command.
-
useRest
Description copied from interface:CommandWithCommunicationApiStepSets REST as the communication API for this command. If this command doesn't support communication over REST, it simply returns the command builder instance unchanged. The default communication API can be configured usingCamundaClientBuilder.preferRestOverGrpc(boolean).- Specified by:
useRestin interfaceCommandWithCommunicationApiStep<CompleteJobCommandStep1>- Returns:
- the configured command
-
useGrpc
Description copied from interface:CommandWithCommunicationApiStepSets gRPC as the communication API for this command. If this command doesn't support communication over gRPC, it simply returns the command builder instance unchanged. The default communication API can be configured usingCamundaClientBuilder.preferRestOverGrpc(boolean).- Specified by:
useGrpcin interfaceCommandWithCommunicationApiStep<CompleteJobCommandStep1>- Returns:
- the configured command
-
setVariablesInternal
- Specified by:
setVariablesInternalin classCommandWithVariables<CompleteJobCommandStep1>
-