Class StreamJobsCommandImpl
- All Implemented Interfaces:
CommandWithOneOrMoreTenantsStep<StreamJobsCommandStep1.StreamJobsCommandStep3>,CommandWithTenantStep<StreamJobsCommandStep1.StreamJobsCommandStep3>,FinalCommandStep<StreamJobsResponse>,StreamJobsCommandStep1,StreamJobsCommandStep1.StreamJobsCommandStep2,StreamJobsCommandStep1.StreamJobsCommandStep3
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.camunda.zeebe.client.api.command.StreamJobsCommandStep1
StreamJobsCommandStep1.StreamJobsCommandStep2, StreamJobsCommandStep1.StreamJobsCommandStep3 -
Field Summary
Fields inherited from interface io.camunda.zeebe.client.api.command.CommandWithTenantStep
DEFAULT_TENANT_IDENTIFIER -
Constructor Summary
ConstructorsConstructorDescriptionStreamJobsCommandImpl(GatewayGrpc.GatewayStub asyncStub, JsonMapper jsonMapper, Predicate<Throwable> retryPredicate, ZeebeClientConfiguration config) -
Method Summary
Modifier and TypeMethodDescriptionconsumer(Consumer<ActivatedJob> consumer) Sets the consumer to receive activated jobs.fetchVariables(String... fetchVariables) Set a list of variable names which should be fetched on job activation.fetchVariables(List<String> fetchVariables) Set a list of variable names which should be fetch on job activation.Set the type of jobs to work on; only jobs of this type will be activated and consumed by this stream.requestTimeout(Duration requestTimeout) Sets the request timeout for the command.send()Sends the command to the Zeebe broker.Experimental: This method is under development, and as such using it may have no effect on the command builder when called.Shorthand method forCommandWithOneOrMoreTenantsStep.tenantIds(List).Specifies the tenants that may own any entities (e.g.Set the time for how long a job is exclusively assigned for this subscription.workerName(String workerName) Set the name of the job worker.
-
Constructor Details
-
StreamJobsCommandImpl
public StreamJobsCommandImpl(GatewayGrpc.GatewayStub asyncStub, JsonMapper jsonMapper, Predicate<Throwable> retryPredicate, ZeebeClientConfiguration config)
-
-
Method Details
-
requestTimeout
Description copied from interface:FinalCommandStepSets the request timeout for the command. The default request timeout can be configured usingZeebeClientBuilder.defaultRequestTimeout(Duration).- Specified by:
requestTimeoutin interfaceFinalCommandStep<StreamJobsResponse>- Parameters:
requestTimeout- the request timeout- Returns:
- the configured command
-
send
Description copied from interface:FinalCommandStepSends the command to the Zeebe broker. This operation is asynchronous. In case of success, the future returns the event that was generated by the Zeebe broker in response to the command.Call
ZeebeFuture.join()to wait until the response is available.Future<JobEventinvalid input: '>' future = command.send(); JobEvent event = future.join();- Specified by:
sendin interfaceFinalCommandStep<StreamJobsResponse>- Returns:
- a future tracking state of success/failure of the command.
-
jobType
Description copied from interface:StreamJobsCommandStep1Set the type of jobs to work on; only jobs of this type will be activated and consumed by this stream.- Specified by:
jobTypein interfaceStreamJobsCommandStep1- Parameters:
jobType- the type of jobs (e.g. "payment")- Returns:
- the builder for this command
-
consumer
Description copied from interface:StreamJobsCommandStep1.StreamJobsCommandStep2Sets the consumer to receive activated jobs. Note that jobs can be activated on different threads, so the consumer should be thread-safe.- Specified by:
consumerin interfaceStreamJobsCommandStep1.StreamJobsCommandStep2- Parameters:
consumer- the job consumer- Returns:
- the builder's next step
-
timeout
Description copied from interface:StreamJobsCommandStep1.StreamJobsCommandStep3Set the time for how long a job is exclusively assigned for this subscription.In this time, the job can not be assigned by other subscriptions to ensure that only one subscription work on the job. When the time is over then the job can be assigned again by this or other subscription if it's not completed yet.
If no time is set then the default is used from the configuration.
- Specified by:
timeoutin interfaceStreamJobsCommandStep1.StreamJobsCommandStep3- Parameters:
timeout- the time as duration (e.g. "Duration.ofMinutes(5)")- Returns:
- the builder for this command. Call
FinalCommandStep.send()to complete the command and send it to the broker.
-
workerName
Description copied from interface:StreamJobsCommandStep1.StreamJobsCommandStep3Set the name of the job worker.This name is used to identify the worker which activated the jobs. Its main purpose is for monitoring and auditing. Commands on activated jobs do not check the worker name, i.e. complete or fail job.
If no name is set then the default is used from the configuration.
- Specified by:
workerNamein interfaceStreamJobsCommandStep1.StreamJobsCommandStep3- Parameters:
workerName- the name of the worker (e.g. "payment-service")- Returns:
- the builder for this command. Call
FinalCommandStep.send()to complete the command and send it to the broker.
-
fetchVariables
Description copied from interface:StreamJobsCommandStep1.StreamJobsCommandStep3Set a list of variable names which should be fetch on job activation.The jobs which are activated by this command will only contain variables from this list.
This can be used to limit the number of variables of the activated jobs.
- Specified by:
fetchVariablesin interfaceStreamJobsCommandStep1.StreamJobsCommandStep3- Parameters:
fetchVariables- list of variables names to fetch on activation- Returns:
- the builder for this command. Call
FinalCommandStep.send()to complete the command and send it to the broker.
-
fetchVariables
Description copied from interface:StreamJobsCommandStep1.StreamJobsCommandStep3Set a list of variable names which should be fetched on job activation.The jobs which are activated by this command will only contain variables from this list.
This can be used to limit the number of variables of the activated jobs.
- Specified by:
fetchVariablesin interfaceStreamJobsCommandStep1.StreamJobsCommandStep3- Parameters:
fetchVariables- list of variables names to fetch on activation- Returns:
- the builder for this command. Call
FinalCommandStep.send()to complete the command and send it to the broker.
-
tenantId
Description copied from interface:CommandWithOneOrMoreTenantsStepExperimental: This method is under development, and as such using it may have no effect on the command builder when called. While unimplemented, it simply returns the command builder instance unchanged. This method already exists for software that is building support for multi-tenancy, and already wants to use this API during its development. As support for multi-tenancy is added to Zeebe, each of the commands that implement this method may start to take effect. Until this warning is removed, anything described below may not yet have taken effect, and the interface and its description are subject to change.Specifies the tenant that will own any entities (e.g. process definition, process instances, etc.) resulting from this command, or that owns any entities (e.g. jobs) referred to from this command.
Multi-tenancy
Multiple tenants can share a Zeebe cluster. Entities can be assigned to a specific tenant using an identifier. Only that tenant can access these entities.
Any entities created before multi-tenancy has been enabled in the Zeebe cluster, are assigned to the
CommandWithTenantStep.DEFAULT_TENANT_IDENTIFIER.If no tenant is explicitly specified, then the command is rejected.
One or more tenants
This method can be called multiple times to specify multiple tenants.
This can be useful when requesting jobs for multiple tenants at once. Each of the activated jobs will be owned by the tenant that owns the corresponding process instance.
- Specified by:
tenantIdin interfaceCommandWithOneOrMoreTenantsStep<StreamJobsCommandStep1.StreamJobsCommandStep3>- Specified by:
tenantIdin interfaceCommandWithTenantStep<StreamJobsCommandStep1.StreamJobsCommandStep3>- Parameters:
tenantId- the identifier of the tenant to specify for this command, e.g."ACME"- Returns:
- the builder for this command with the tenant specified
-
tenantIds
Description copied from interface:CommandWithOneOrMoreTenantsStepSpecifies the tenants that may own any entities (e.g. process definition, process instances, etc.) resulting from this command.One or more tenants
This can be useful when requesting jobs for multiple tenants at once. Each of the activated jobs will be owned by the tenant that owns the corresponding process instance.
- Specified by:
tenantIdsin interfaceCommandWithOneOrMoreTenantsStep<StreamJobsCommandStep1.StreamJobsCommandStep3>- Parameters:
tenantIds- the identifiers of the tenants to specify for this command, e.g.["ACME", "OTHER"]- Returns:
- the builder for this command with the tenants specified
- See Also:
-
tenantIds
Description copied from interface:CommandWithOneOrMoreTenantsStepShorthand method forCommandWithOneOrMoreTenantsStep.tenantIds(List).- Specified by:
tenantIdsin interfaceCommandWithOneOrMoreTenantsStep<StreamJobsCommandStep1.StreamJobsCommandStep3>- Parameters:
tenantIds- the identifiers of the tenants to specify for this command, e.g.["ACME", "OTHER"]- Returns:
- the builder for this command with the tenants specified
- See Also:
-