Class ThrowErrorCommandImpl
- All Implemented Interfaces:
CommandWithCommunicationApiStep<ThrowErrorCommandStep1>,CommandWithVariables<ThrowErrorCommandStep1.ThrowErrorCommandStep2>,FinalCommandStep<ThrowErrorResponse>,JobCallbackFinalCommandStep<ThrowErrorResponse>,ThrowErrorCommandStep1,ThrowErrorCommandStep1.ThrowErrorCommandStep2
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.camunda.client.api.command.ThrowErrorCommandStep1
ThrowErrorCommandStep1.ThrowErrorCommandStep2 -
Field Summary
Fields inherited from class io.camunda.client.impl.command.CommandWithVariables
objectMapper -
Constructor Summary
ConstructorsConstructorDescriptionThrowErrorCommandImpl(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 TypeMethodDescriptionSet the errorCode for the error.errorMessage(String errorMsg) Provide an error message describing the reason for the non-technical error.requestTimeout(Duration requestTimeout) Sets the request timeout for the command.send()Sends the command to the Camunda gateway.setVariablesInternal(String variables) useGrpc()Sets gRPC as the communication API for this command.useRest()Sets REST as the communication API for this command.withLeaseToken(String leaseToken) Sets the lease token identifying the job's activation, fencing this command against a superseded activation of the same job.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.FinalCommandStep
execute
-
Constructor Details
-
ThrowErrorCommandImpl
public ThrowErrorCommandImpl(io.camunda.zeebe.gateway.protocol.GatewayGrpc.GatewayStub asyncStub, JsonMapper jsonMapper, long key, Duration requestTimeout, Predicate<CredentialsProvider.StatusCode> retryPredicate, HttpClient httpClient, boolean preferRestOverGrpc)
-
-
Method Details
-
errorCode
Description copied from interface:ThrowErrorCommandStep1Set the errorCode for the error.If the errorCode can't be matched to an error catch event in the process, an incident will be created.
- Specified by:
errorCodein interfaceThrowErrorCommandStep1- Parameters:
errorCode- the errorCode that will be matched against an error catch event- Returns:
- the builder for this command. Call
FinalCommandStep.send()to complete the command and send it to the broker.
-
errorMessage
Description copied from interface:ThrowErrorCommandStep1.ThrowErrorCommandStep2Provide an error message describing the reason for the non-technical error. If the error is not caught by an error catch event, this message will be a part of the raised incident.- Specified by:
errorMessagein interfaceThrowErrorCommandStep1.ThrowErrorCommandStep2- Parameters:
errorMsg- error message- Returns:
- the builder for this command. Call
FinalCommandStep.send()to complete the command and send it to the broker.
-
withLeaseToken
Description copied from interface:ThrowErrorCommandStep1.ThrowErrorCommandStep2Sets 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.
newThrowErrorCommand(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 interfaceThrowErrorCommandStep1.ThrowErrorCommandStep2- 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.
-
setVariablesInternal
- Specified by:
setVariablesInternalin classCommandWithVariables<ThrowErrorCommandStep1.ThrowErrorCommandStep2>
-
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<ThrowErrorResponse>- 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<ThrowErrorResponse>- Returns:
- a future tracking state of success/failure of the 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<ThrowErrorCommandStep1>- 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<ThrowErrorCommandStep1>- Returns:
- the configured command
-