Package io.camunda.zeebe.client.impl
Class ZeebeClientBuilderImpl
java.lang.Object
io.camunda.zeebe.client.impl.ZeebeClientBuilderImpl
- All Implemented Interfaces:
ZeebeClientBuilder,ZeebeClientConfiguration
public final class ZeebeClientBuilderImpl
extends Object
implements ZeebeClientBuilder, ZeebeClientConfiguration
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapplyEnvironmentVariableOverrides(boolean applyEnvironmentVariableOverrides) Allows to disable the mechanism to override some properties by ENVIRONMENT VARIABLES.build()caCertificatePath(String certificatePath) Path to a root CA certificate to be used instead of the certificate in the default default store.credentialsProvider(CredentialsProvider credentialsProvider) A customCredentialsProviderwhich will be used to apply authentication credentials to requests.defaultJobPollInterval(Duration pollInterval) The interval which a job worker is periodically polling for new jobs.defaultJobTimeout(Duration timeout) The timeout which is used when none is provided for a job worker.defaultJobWorkerMaxJobsActive(int maxJobsActive) defaultJobWorkerName(String workerName) The name of the worker which is used when none is set for a job worker.defaultJobWorkerStreamEnabled(boolean streamEnabled) A custom streamEnabled allows the client to use job stream instead of job poll.defaultJobWorkerTenantIds(List<String> tenantIds) defaultMessageTimeToLive(Duration timeToLive) The time-to-live which is used when none is provided for a message.defaultRequestTimeout(Duration requestTimeout) The request timeout used if not overridden by the command.defaultTenantId(String tenantId) gatewayAddress(String gatewayAddress) List<org.apache.hc.client5.http.async.AsyncExecChainHandler> intbooleanList<io.grpc.ClientInterceptor> intintintgrpcAddress(URI grpcAddress) booleanjobWorkerExecutor(ScheduledExecutorService executor, boolean takeOwnership) Allows passing a custom executor service that will be shared by all job workers created via this client.Time interval between keep alive messages sent to the gateway.maxMessageSize(int maxMessageSize) A custom maxMessageSize allows the client to receive larger or smaller responses from Zeebe.maxMetadataSize(int maxMetadataSize) A custom maxMetadataSize allows the client to receive larger or smaller response headers from Zeebe.numJobWorkerExecutionThreads(int numSubscriptionThreads) overrideAuthority(String authority) Overrides the authority used with TLS virtual hosting.booleanbooleanpreferRestOverGrpc(boolean preferRestOverGrpc) If true, will prefer to use REST over gRPC for calls which can be done over both REST and gRPC.restAddress(URI restAddress) toString()booleanuseDefaultRetryPolicy(boolean useDefaultRetryPolicy) If enabled, the client will make use of the default retry policy defined.Use a plaintext connection between the client and the gateway.withChainHandlers(org.apache.hc.client5.http.async.AsyncExecChainHandler... chainHandler) Custom implementations of the Apache HttpClientAsyncExecChainHandlermiddleware API.withInterceptors(io.grpc.ClientInterceptor... interceptors) Custom implementations of the gRPCClientInterceptormiddleware API.withJsonMapper(JsonMapper jsonMapper) withProperties(Properties properties) Sets all the properties from aPropertiesobject.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.camunda.zeebe.client.ZeebeClientBuilder
jobWorkerExecutor
-
Field Details
-
DEFAULT_GATEWAY_ADDRESS
- See Also:
-
DEFAULT_GRPC_ADDRESS
-
DEFAULT_REST_ADDRESS
-
DEFAULT_JOB_WORKER_NAME_VAR
- See Also:
-
DEFAULT_MESSAGE_TTL
-
-
Constructor Details
-
ZeebeClientBuilderImpl
public ZeebeClientBuilderImpl()
-
-
Method Details
-
getGatewayAddress
- Specified by:
getGatewayAddressin interfaceZeebeClientConfiguration- See Also:
-
getRestAddress
- Specified by:
getRestAddressin interfaceZeebeClientConfiguration- See Also:
-
getGrpcAddress
- Specified by:
getGrpcAddressin interfaceZeebeClientConfiguration- See Also:
-
getDefaultTenantId
- Specified by:
getDefaultTenantIdin interfaceZeebeClientConfiguration- See Also:
-
getDefaultJobWorkerTenantIds
- Specified by:
getDefaultJobWorkerTenantIdsin interfaceZeebeClientConfiguration- See Also:
-
getNumJobWorkerExecutionThreads
public int getNumJobWorkerExecutionThreads()- Specified by:
getNumJobWorkerExecutionThreadsin interfaceZeebeClientConfiguration- See Also:
-
getDefaultJobWorkerMaxJobsActive
public int getDefaultJobWorkerMaxJobsActive()- Specified by:
getDefaultJobWorkerMaxJobsActivein interfaceZeebeClientConfiguration- See Also:
-
getDefaultJobWorkerName
- Specified by:
getDefaultJobWorkerNamein interfaceZeebeClientConfiguration- See Also:
-
getDefaultJobTimeout
- Specified by:
getDefaultJobTimeoutin interfaceZeebeClientConfiguration- See Also:
-
getDefaultJobPollInterval
- Specified by:
getDefaultJobPollIntervalin interfaceZeebeClientConfiguration- See Also:
-
getDefaultMessageTimeToLive
- Specified by:
getDefaultMessageTimeToLivein interfaceZeebeClientConfiguration- See Also:
-
getDefaultRequestTimeout
- Specified by:
getDefaultRequestTimeoutin interfaceZeebeClientConfiguration- See Also:
-
isPlaintextConnectionEnabled
public boolean isPlaintextConnectionEnabled()- Specified by:
isPlaintextConnectionEnabledin interfaceZeebeClientConfiguration- See Also:
-
getCaCertificatePath
- Specified by:
getCaCertificatePathin interfaceZeebeClientConfiguration- See Also:
-
getCredentialsProvider
- Specified by:
getCredentialsProviderin interfaceZeebeClientConfiguration- See Also:
-
getKeepAlive
- Specified by:
getKeepAlivein interfaceZeebeClientConfiguration- See Also:
-
getInterceptors
- Specified by:
getInterceptorsin interfaceZeebeClientConfiguration- See Also:
-
getChainHandlers
- Specified by:
getChainHandlersin interfaceZeebeClientConfiguration- See Also:
-
getJsonMapper
- Specified by:
getJsonMapperin interfaceZeebeClientConfiguration- See Also:
-
getOverrideAuthority
- Specified by:
getOverrideAuthorityin interfaceZeebeClientConfiguration- See Also:
-
getMaxMessageSize
public int getMaxMessageSize()- Specified by:
getMaxMessageSizein interfaceZeebeClientConfiguration- See Also:
-
getMaxMetadataSize
public int getMaxMetadataSize()- Specified by:
getMaxMetadataSizein interfaceZeebeClientConfiguration- See Also:
-
jobWorkerExecutor
- Specified by:
jobWorkerExecutorin interfaceZeebeClientConfiguration- See Also:
-
ownsJobWorkerExecutor
public boolean ownsJobWorkerExecutor()- Specified by:
ownsJobWorkerExecutorin interfaceZeebeClientConfiguration- See Also:
-
getDefaultJobWorkerStreamEnabled
public boolean getDefaultJobWorkerStreamEnabled()- Specified by:
getDefaultJobWorkerStreamEnabledin interfaceZeebeClientConfiguration- See Also:
-
useDefaultRetryPolicy
public boolean useDefaultRetryPolicy()- Specified by:
useDefaultRetryPolicyin interfaceZeebeClientConfiguration- See Also:
-
preferRestOverGrpc
public boolean preferRestOverGrpc()- Specified by:
preferRestOverGrpcin interfaceZeebeClientConfiguration- See Also:
-
withProperties
Description copied from interface:ZeebeClientBuilderSets all the properties from aPropertiesobject. Can be used to configure the client from a properties file.See
ClientPropertiesfor valid property names.- Specified by:
withPropertiesin interfaceZeebeClientBuilder
-
applyEnvironmentVariableOverrides
public ZeebeClientBuilder applyEnvironmentVariableOverrides(boolean applyEnvironmentVariableOverrides) Description copied from interface:ZeebeClientBuilderAllows to disable the mechanism to override some properties by ENVIRONMENT VARIABLES. This is useful if a client shall be constructed for test cases or in an environment that wants to fully control properties (like Spring Boot).The default value is
true.- Specified by:
applyEnvironmentVariableOverridesin interfaceZeebeClientBuilder
-
gatewayAddress
- Specified by:
gatewayAddressin interfaceZeebeClientBuilder- Parameters:
gatewayAddress- the IP socket address of a gateway that the client can initially connect to. Must be in formathost:port. The default value is0.0.0.0:26500.
-
restAddress
- Specified by:
restAddressin interfaceZeebeClientBuilder- Parameters:
restAddress- the REST API address of a gateway that the client can connect to. The address must be an absolute URL, including the scheme.The default value is
https://0.0.0.0:8080.
-
grpcAddress
- Specified by:
grpcAddressin interfaceZeebeClientBuilder- Parameters:
grpcAddress- the gRPC address of a gateway that the client can connect to. The address must be an absolute URL, including the scheme.The default value is
https://0.0.0.0:26500.
-
defaultTenantId
- Specified by:
defaultTenantIdin interfaceZeebeClientBuilder- Parameters:
tenantId- the tenant identifier which is used for tenant-aware commands when no tenant identifier is set. The default value isCommandWithTenantStep.DEFAULT_TENANT_IDENTIFIER.
-
defaultJobWorkerTenantIds
- Specified by:
defaultJobWorkerTenantIdsin interfaceZeebeClientBuilder- Parameters:
tenantIds- the tenant identifiers which are used for job-activation commands when no tenant identifiers are set. The default value contains onlyCommandWithTenantStep.DEFAULT_TENANT_IDENTIFIER.
-
defaultJobWorkerMaxJobsActive
- Specified by:
defaultJobWorkerMaxJobsActivein interfaceZeebeClientBuilder- Parameters:
maxJobsActive- Default value forJobWorkerBuilderStep1.JobWorkerBuilderStep3.maxJobsActive(int). Default value is 32.
-
numJobWorkerExecutionThreads
- Specified by:
numJobWorkerExecutionThreadsin interfaceZeebeClientBuilder- Parameters:
numSubscriptionThreads- The number of threads for invocation of job workers. Setting this value to 0 effectively disables subscriptions and workers. Default value is 1.
-
jobWorkerExecutor
public ZeebeClientBuilder jobWorkerExecutor(ScheduledExecutorService executor, boolean takeOwnership) Description copied from interface:ZeebeClientBuilderAllows passing a custom executor service that will be shared by all job workers created via this client.Polling and handling jobs (e.g. via
JobHandlerwill all be invoked on this executor.When non-null, this setting override
ZeebeClientBuilder.numJobWorkerExecutionThreads(int).- Specified by:
jobWorkerExecutorin interfaceZeebeClientBuilder- Parameters:
executor- an executor service to use when invoking job workerstakeOwnership- if true, the executor will be closed when the client is closed. otherwise, it's up to the caller to manage its lifecycle
-
defaultJobWorkerName
Description copied from interface:ZeebeClientBuilderThe name of the worker which is used when none is set for a job worker. Default is 'default'.- Specified by:
defaultJobWorkerNamein interfaceZeebeClientBuilder
-
defaultJobTimeout
Description copied from interface:ZeebeClientBuilderThe timeout which is used when none is provided for a job worker. Default is 5 minutes.- Specified by:
defaultJobTimeoutin interfaceZeebeClientBuilder
-
defaultJobPollInterval
Description copied from interface:ZeebeClientBuilderThe interval which a job worker is periodically polling for new jobs. Default is 100 milliseconds.- Specified by:
defaultJobPollIntervalin interfaceZeebeClientBuilder
-
defaultMessageTimeToLive
Description copied from interface:ZeebeClientBuilderThe time-to-live which is used when none is provided for a message. Default is 1 hour.- Specified by:
defaultMessageTimeToLivein interfaceZeebeClientBuilder
-
defaultRequestTimeout
Description copied from interface:ZeebeClientBuilderThe request timeout used if not overridden by the command. Default is 10 seconds.- Specified by:
defaultRequestTimeoutin interfaceZeebeClientBuilder
-
usePlaintext
Description copied from interface:ZeebeClientBuilderUse a plaintext connection between the client and the gateway.- Specified by:
usePlaintextin interfaceZeebeClientBuilder
-
caCertificatePath
Description copied from interface:ZeebeClientBuilderPath to a root CA certificate to be used instead of the certificate in the default default store.- Specified by:
caCertificatePathin interfaceZeebeClientBuilder
-
credentialsProvider
Description copied from interface:ZeebeClientBuilderA customCredentialsProviderwhich will be used to apply authentication credentials to requests.- Specified by:
credentialsProviderin interfaceZeebeClientBuilder
-
keepAlive
Description copied from interface:ZeebeClientBuilderTime interval between keep alive messages sent to the gateway. The default is 45 seconds.- Specified by:
keepAlivein interfaceZeebeClientBuilder
-
withInterceptors
Description copied from interface:ZeebeClientBuilderCustom implementations of the gRPCClientInterceptormiddleware API. The interceptors will be applied to every gRPC call that the client makes. More details can be found at invalid input: '{@link https://grpc.io/docs/guides/interceptors/'}.- Specified by:
withInterceptorsin interfaceZeebeClientBuilder
-
withChainHandlers
public ZeebeClientBuilder withChainHandlers(org.apache.hc.client5.http.async.AsyncExecChainHandler... chainHandler) Description copied from interface:ZeebeClientBuilderCustom implementations of the Apache HttpClientAsyncExecChainHandlermiddleware API. The middleware implementations will be called on every REST API call that the client makes.- Specified by:
withChainHandlersin interfaceZeebeClientBuilder
-
withJsonMapper
- Specified by:
withJsonMapperin interfaceZeebeClientBuilder
-
overrideAuthority
Description copied from interface:ZeebeClientBuilderOverrides the authority used with TLS virtual hosting. Specifically, to override hostname verification in the TLS handshake. It does not change what host is actually connected to.This method is intended for testing, but may safely be used outside of tests as an alternative to DNS overrides.
This setting does nothing if a
plaintextconnection is used.- Specified by:
overrideAuthorityin interfaceZeebeClientBuilder- Parameters:
authority- The alternative authority to use, commonly in the formhostorhost:port
-
maxMessageSize
Description copied from interface:ZeebeClientBuilderA custom maxMessageSize allows the client to receive larger or smaller responses from Zeebe. Technically, it specifies the maxInboundMessageSize of the gRPC channel. The default is 5242880 = 5MB.- Specified by:
maxMessageSizein interfaceZeebeClientBuilder
-
maxMetadataSize
Description copied from interface:ZeebeClientBuilderA custom maxMetadataSize allows the client to receive larger or smaller response headers from Zeebe. Technically, it specifies the maxInboundMetadataSize of the gRPC channel. The default is 16384 = 16KB .- Specified by:
maxMetadataSizein interfaceZeebeClientBuilder
-
defaultJobWorkerStreamEnabled
Description copied from interface:ZeebeClientBuilderA custom streamEnabled allows the client to use job stream instead of job poll. The default value is set as enabled.- Specified by:
defaultJobWorkerStreamEnabledin interfaceZeebeClientBuilder
-
useDefaultRetryPolicy
Description copied from interface:ZeebeClientBuilderIf enabled, the client will make use of the default retry policy defined. False by default.NOTE: the default retry policy is taken from the
gateway-service-config.jsonin theio.camunda:zeebe-gateway-protocol-implJAR.- Specified by:
useDefaultRetryPolicyin interfaceZeebeClientBuilder
-
preferRestOverGrpc
Description copied from interface:ZeebeClientBuilderIf true, will prefer to use REST over gRPC for calls which can be done over both REST and gRPC. This is an experimental API which is present while we migrate the bulk of the API from gRPC to REST. Once done, this will also be removed.NOTE: not all calls can be done over REST (or HTTP/1) yet, this is also subject to change.
- Specified by:
preferRestOverGrpcin interfaceZeebeClientBuilder- Parameters:
preferRestOverGrpc- if true, the client will use REST instead of gRPC whenever possible- Returns:
- this builder for chaining
-
build
- Specified by:
buildin interfaceZeebeClientBuilder- Returns:
- a new
ZeebeClientwith the provided configuration options.
-
toString
-