Package org.camunda.bpm.client
Interface ExternalTaskClientBuilder
- All Known Implementing Classes:
ExternalTaskClientBuilderImpl
public interface ExternalTaskClientBuilder
A fluent builder to configure the Camunda client
- Author:
- Tassilo Weidner
-
Method Summary
Modifier and TypeMethodDescriptionaddInterceptor
(ClientRequestInterceptor interceptor) Adds an interceptor to change a request before it is sent to the http server.asyncResponseTimeout
(long asyncResponseTimeout) Asynchronous response (long polling) is enabled if a timeout is given.backoffStrategy
(BackoffStrategy backoffStrategy) Adds a custom strategy to the client for defining the org.camunda.bpm.client.backoff between two requests.Base url of the Camunda BPM Platform REST API.build()
Bootstraps the Camunda clientdateFormat
(String dateFormat) Specifies the date format to de-/serialize date variables.defaultSerializationFormat
(String defaultSerializationFormat) Specifies the serialization format that is used to serialize objects when no specific format is requested.Disables immediate fetching for external tasks after callingbuild()
to bootstrap the client.Disables the client-side backoff strategy.lockDuration
(long lockDuration) maxTasks
(int maxTasks) Specifies the maximum amount of tasks that can be fetched within one request.usePriority
(boolean usePriority) Specifies whether tasks should be fetched based on their priority or arbitrarily.A custom worker id the Workflow Engine is aware of.
-
Method Details
-
baseUrl
Base url of the Camunda BPM Platform REST API. This information is mandatory.- Parameters:
baseUrl
- of the Camunda BPM Platform REST API- Returns:
- the builder
-
workerId
A custom worker id the Workflow Engine is aware of. This information is optional. Note: make sure to choose a unique worker id If not given or null, a worker id is generated automatically which consists of the hostname as well as a random and unique 128 bit string (UUID).- Parameters:
workerId
- the Workflow Engine is aware of- Returns:
- the builder
-
addInterceptor
Adds an interceptor to change a request before it is sent to the http server. This information is optional.- Parameters:
interceptor
- which changes the request- Returns:
- the builder
-
maxTasks
Specifies the maximum amount of tasks that can be fetched within one request. This information is optional. Default is 10.- Parameters:
maxTasks
- which are supposed to be fetched within one request- Returns:
- the builder
-
usePriority
Specifies whether tasks should be fetched based on their priority or arbitrarily. This information is optional. Default istrue
.- Parameters:
usePriority
- when fetching and locking tasks- Returns:
- the builder
-
defaultSerializationFormat
Specifies the serialization format that is used to serialize objects when no specific format is requested. This option defaults to application/json.- Parameters:
defaultSerializationFormat
- serialization format to be used- Returns:
- the builder
-
dateFormat
Specifies the date format to de-/serialize date variables.- Parameters:
dateFormat
- date format to be used- Returns:
- the builder
-
asyncResponseTimeout
Asynchronous response (long polling) is enabled if a timeout is given. Specifies the maximum waiting time for the response of fetched and locked external tasks. The response is performed immediately, if external tasks are available in the moment of the request. This information is optional. Unless a timeout is given, fetch and lock responses are synchronous.- Parameters:
asyncResponseTimeout
- of fetched and locked external tasks in milliseconds- Returns:
- the builder
-
lockDuration
- Parameters:
lockDuration
-- in milliseconds to lock the external tasks
- must be greater than zero
- the default lock duration is 20 seconds (20,000 milliseconds)
- is overridden by the lock duration configured on a topic subscription
- Returns:
- the builder
-
disableAutoFetching
ExternalTaskClientBuilder disableAutoFetching()Disables immediate fetching for external tasks after callingbuild()
to bootstrap the client. To start fetchingExternalTaskClient.start()
must be called.- Returns:
- the builder
-
backoffStrategy
Adds a custom strategy to the client for defining the org.camunda.bpm.client.backoff between two requests. This information is optional. By defaultExponentialBackoffStrategy
is applied.- Parameters:
backoffStrategy
- which realizes a custom org.camunda.bpm.client.backoff strategy- Returns:
- the builder
-
disableBackoffStrategy
ExternalTaskClientBuilder disableBackoffStrategy()Disables the client-side backoff strategy. On invocation, the configuration optionbackoffStrategy(org.camunda.bpm.client.backoff.BackoffStrategy)
is ignored. NOTE: Please bear in mind that disabling the client-side backoff can lead to heavy load situations on engine side. To avoid this, please specify an appropriateasyncResponseTimeout(long)
.- Returns:
- the builder
-
build
ExternalTaskClient build()Bootstraps the Camunda client- Returns:
- the builder
- Throws:
ExternalTaskClientException
-- if base url is null or string is empty
- if hostname cannot be retrieved
- if maximum amount of tasks is not greater than zero
- if maximum asynchronous response timeout is not greater than zero
- if lock duration is not greater than zero
-