Package org.camunda.bpm.client.impl
Class ExternalTaskClientBuilderImpl
java.lang.Object
org.camunda.bpm.client.impl.ExternalTaskClientBuilderImpl
- All Implemented Interfaces:
ExternalTaskClientBuilder
- Author:
- Tassilo Weidner
-
Field Summary
Modifier and TypeFieldDescriptionprotected Long
protected BackoffStrategy
protected String
protected String
protected String
protected EngineClient
protected org.apache.hc.client5.http.impl.classic.HttpClientBuilder
protected List<ClientRequestInterceptor>
protected boolean
protected boolean
protected long
protected static final ExternalTaskClientLogger
protected int
protected com.fasterxml.jackson.databind.ObjectMapper
protected OrderingConfig
protected TopicSubscriptionManager
protected TypedValues
protected boolean
protected ValueMappers
protected String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddInterceptor
(ClientRequestInterceptor interceptor) Adds an interceptor to change a request before it is sent to the http server.protected void
applyConfigurator
(Map<String, DataFormat> dataFormats, DataFormatConfigurator configurator) protected void
applyConfigurators
(Map<String, DataFormat> dataFormats) asc()
Fluent API method to configure Ascending order on the associated field.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 clientprotected void
customizeHttpClient
(Consumer<org.apache.hc.client5.http.impl.classic.HttpClientBuilder> httpClientConsumer) Exposes the internal ApacheHttpClientBuilder
for custom client configurations.dateFormat
(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.desc()
Fluent API method to configure Descending order on the associated field.Disables immediate fetching for external tasks after callingExternalTaskClientBuilder.build()
to bootstrap the client.Disables the client-side backoff strategy.protected Long
protected BackoffStrategy
protected List<ClientRequestInterceptor>
protected long
protected int
com.fasterxml.jackson.databind.ObjectMapper
protected String
protected void
protected void
protected void
protected void
protected void
protected void
protected boolean
lockDuration
(long lockDuration) protected void
lookupCustomDataFormats
(Map<String, DataFormat> dataFormats) protected Map<String,
DataFormat> protected void
lookupProvider
(Map<String, DataFormat> dataFormats, DataFormatProvider provider) maxTasks
(int maxTasks) Specifies the maximum amount of tasks that can be fetched within one request.Fluent API method for configuring createTime as a sorting criterion for fetching of the tasks.protected String
sanitizeUrl
(String url) useCreateTime
(boolean useCreateTime) Specifies whether tasks should be fetched based on their create time.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.
-
Field Details
-
LOG
-
baseUrl
-
workerId
-
maxTasks
protected int maxTasks -
usePriority
protected boolean usePriority -
orderingConfig
-
asyncResponseTimeout
-
lockDuration
protected long lockDuration -
defaultSerializationFormat
-
dateFormat
-
objectMapper
protected com.fasterxml.jackson.databind.ObjectMapper objectMapper -
valueMappers
-
typedValues
-
engineClient
-
topicSubscriptionManager
-
httpClientBuilder
protected org.apache.hc.client5.http.impl.classic.HttpClientBuilder httpClientBuilder -
interceptors
-
isAutoFetchingEnabled
protected boolean isAutoFetchingEnabled -
backoffStrategy
-
isBackoffStrategyDisabled
protected boolean isBackoffStrategyDisabled
-
-
Constructor Details
-
ExternalTaskClientBuilderImpl
public ExternalTaskClientBuilderImpl()
-
-
Method Details
-
baseUrl
Description copied from interface:ExternalTaskClientBuilder
Base url of the Camunda BPM Platform REST API. This information is mandatory.- Specified by:
baseUrl
in interfaceExternalTaskClientBuilder
- Parameters:
baseUrl
- of the Camunda BPM Platform REST API- Returns:
- the builder
-
workerId
Description copied from interface:ExternalTaskClientBuilder
A custom worker id the Workflow Engine is aware of. This information is optional. Note: make sure to choose a unique worker idIf 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).
- Specified by:
workerId
in interfaceExternalTaskClientBuilder
- Parameters:
workerId
- the Workflow Engine is aware of- Returns:
- the builder
-
addInterceptor
Description copied from interface:ExternalTaskClientBuilder
Adds an interceptor to change a request before it is sent to the http server. This information is optional.- Specified by:
addInterceptor
in interfaceExternalTaskClientBuilder
- Parameters:
interceptor
- which changes the request- Returns:
- the builder
-
maxTasks
Description copied from interface:ExternalTaskClientBuilder
Specifies the maximum amount of tasks that can be fetched within one request. This information is optional. Default is 10.- Specified by:
maxTasks
in interfaceExternalTaskClientBuilder
- Parameters:
maxTasks
- which are supposed to be fetched within one request- Returns:
- the builder
-
usePriority
Description copied from interface:ExternalTaskClientBuilder
Specifies whether tasks should be fetched based on their priority or arbitrarily. This information is optional. Default istrue
.- Specified by:
usePriority
in interfaceExternalTaskClientBuilder
- Parameters:
usePriority
- when fetching and locking tasks- Returns:
- the builder
-
useCreateTime
Description copied from interface:ExternalTaskClientBuilder
Specifies whether tasks should be fetched based on their create time. If useCreateTime is passed usingtrue
, the tasks are going to be fetched in Descending order, otherwisefalse
will not consider create time.- Specified by:
useCreateTime
in interfaceExternalTaskClientBuilder
- Parameters:
useCreateTime
- the flag to control whether create time should be considered as a desc sorting criterion (newer tasks will be returned first)- Returns:
- the builder
-
orderByCreateTime
Description copied from interface:ExternalTaskClientBuilder
Fluent API method for configuring createTime as a sorting criterion for fetching of the tasks. Can be used in conjunction with asc or desc methods to configure the respective order for createTime. The method needs to be called first before specifying the order.- Specified by:
orderByCreateTime
in interfaceExternalTaskClientBuilder
- Returns:
- the builder
-
asc
Description copied from interface:ExternalTaskClientBuilder
Fluent API method to configure Ascending order on the associated field. Used in conjunction with an orderBy method such as orderByCreateTime.- Specified by:
asc
in interfaceExternalTaskClientBuilder
- Returns:
- the builder
-
desc
Description copied from interface:ExternalTaskClientBuilder
Fluent API method to configure Descending order on the associated field. Used in conjunction with an orderBy method such as orderByCreateTime.- Specified by:
desc
in interfaceExternalTaskClientBuilder
- Returns:
- the builder
-
asyncResponseTimeout
Description copied from interface:ExternalTaskClientBuilder
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.- Specified by:
asyncResponseTimeout
in interfaceExternalTaskClientBuilder
- Parameters:
asyncResponseTimeout
- of fetched and locked external tasks in milliseconds- Returns:
- the builder
-
lockDuration
- Specified by:
lockDuration
in interfaceExternalTaskClientBuilder
- 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
Description copied from interface:ExternalTaskClientBuilder
Disables immediate fetching for external tasks after callingExternalTaskClientBuilder.build()
to bootstrap the client. To start fetchingExternalTaskClient.start()
must be called.- Specified by:
disableAutoFetching
in interfaceExternalTaskClientBuilder
- Returns:
- the builder
-
backoffStrategy
Description copied from interface:ExternalTaskClientBuilder
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.- Specified by:
backoffStrategy
in interfaceExternalTaskClientBuilder
- Parameters:
backoffStrategy
- which realizes a custom org.camunda.bpm.client.backoff strategy- Returns:
- the builder
-
disableBackoffStrategy
Description copied from interface:ExternalTaskClientBuilder
Disables the client-side backoff strategy. On invocation, the configuration optionExternalTaskClientBuilder.backoffStrategy(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 appropriate
ExternalTaskClientBuilder.asyncResponseTimeout(long)
.- Specified by:
disableBackoffStrategy
in interfaceExternalTaskClientBuilder
- Returns:
- the builder
-
defaultSerializationFormat
Description copied from interface:ExternalTaskClientBuilder
Specifies the serialization format that is used to serialize objects when no specific format is requested. This option defaults to application/json.- Specified by:
defaultSerializationFormat
in interfaceExternalTaskClientBuilder
- Parameters:
defaultSerializationFormat
- serialization format to be used- Returns:
- the builder
-
dateFormat
Description copied from interface:ExternalTaskClientBuilder
Specifies the date format to de-/serialize date variables.- Specified by:
dateFormat
in interfaceExternalTaskClientBuilder
- Parameters:
dateFormat
- date format to be used- Returns:
- the builder
-
customizeHttpClient
public ExternalTaskClientBuilder customizeHttpClient(Consumer<org.apache.hc.client5.http.impl.classic.HttpClientBuilder> httpClientConsumer) Description copied from interface:ExternalTaskClientBuilder
Exposes the internal ApacheHttpClientBuilder
for custom client configurations.Interceptors added via
ExternalTaskClientBuilder.addInterceptor(ClientRequestInterceptor)
are added as last in theExternalTaskClientBuilder.build()
method.- Specified by:
customizeHttpClient
in interfaceExternalTaskClientBuilder
- Parameters:
httpClientConsumer
- the parameter that accepts theHttpClientBuilder
- Returns:
- the builder
-
build
Description copied from interface:ExternalTaskClientBuilder
Bootstraps the Camunda client- Specified by:
build
in interfaceExternalTaskClientBuilder
- Returns:
- the builder
-
initBaseUrl
protected void initBaseUrl() -
sanitizeUrl
-
initWorkerId
protected void initWorkerId() -
checkInterceptors
protected void checkInterceptors() -
initObjectMapper
protected void initObjectMapper() -
initVariableMappers
protected void initVariableMappers() -
initEngineClient
protected void initEngineClient() -
initTopicSubscriptionManager
protected void initTopicSubscriptionManager() -
lookupDataFormats
-
lookupCustomDataFormats
-
lookupProvider
-
applyConfigurators
-
applyConfigurator
protected void applyConfigurator(Map<String, DataFormat> dataFormats, DataFormatConfigurator configurator) -
checkHostname
-
getHostname
- Throws:
UnknownHostException
-
getBaseUrl
-
getWorkerId
-
getInterceptors
-
getMaxTasks
protected int getMaxTasks() -
getAsyncResponseTimeout
-
getLockDuration
protected long getLockDuration() -
isAutoFetchingEnabled
protected boolean isAutoFetchingEnabled() -
getBackoffStrategy
-
getDefaultSerializationFormat
-
getDateFormat
-
getObjectMapper
public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper() -
getValueMappers
-
getTypedValues
-
getEngineClient
-