public static class DbSchedulerDeadlineManager.Builder extends Object
DbSchedulerDeadlineManager
.
The TransactionManager
is defaulted to a NoTransactionManager
, the DefaultDeadlineManagerSpanFactory
defaults
to a DefaultDeadlineManagerSpanFactory
backed by a NoOpSpanFactory
. The useBinaryPojo
and startScheduler
are defaulted to
true
.
The JobScheduler
, ScopeAwareProvider
and Serializer
are hard requirements and as
such should be provided.
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
DbSchedulerDeadlineManager |
build()
Initializes a
DbSchedulerDeadlineManager as specified through this Builder. |
DbSchedulerDeadlineManager.Builder |
scheduler(com.github.kagkarlsson.scheduler.Scheduler scheduler)
Sets the
Scheduler used for scheduling and triggering purposes of deadlines. |
DbSchedulerDeadlineManager.Builder |
scopeAwareProvider(ScopeAwareProvider scopeAwareProvider)
Sets the
ScopeAwareProvider which is capable of providing a stream of
Scope instances for a given ScopeDescriptor . |
DbSchedulerDeadlineManager.Builder |
serializer(Serializer serializer)
Sets the
Serializer used to de-/serialize the payload ,
MetaData and the ScopeDescriptor into the DeadlineDetails
as well as the whole DeadlineDetails itself. |
DbSchedulerDeadlineManager.Builder |
spanFactory(DeadlineManagerSpanFactory spanFactory)
Sets the
DeadlineManagerSpanFactory implementation to use for providing tracing capabilities. |
DbSchedulerDeadlineManager.Builder |
spanFactory(SpanFactory spanFactory)
Deprecated.
Use
spanFactory(DeadlineManagerSpanFactory) instead as it provides more configuration options. |
DbSchedulerDeadlineManager.Builder |
startScheduler(boolean startScheduler)
Sets whether to start the
Scheduler using the Lifecycle , or to never start the scheduler from
this component instead. |
DbSchedulerDeadlineManager.Builder |
stopScheduler(boolean stopScheduler)
Sets whether to stop the
Scheduler using the Lifecycle , or to never stop the scheduler from
this component instead. |
DbSchedulerDeadlineManager.Builder |
transactionManager(TransactionManager transactionManager)
Sets the
TransactionManager used to build transactions and ties them to deadline. |
DbSchedulerDeadlineManager.Builder |
useBinaryPojo(boolean useBinaryPojo)
Sets whether to use a pojo optimized for size,
DbSchedulerBinaryEventData , compared to a pojo
optimized for readability, DbSchedulerEventScheduler . |
protected void |
validate()
Validates whether the fields contained in this Builder are set accordingly.
|
public DbSchedulerDeadlineManager.Builder scheduler(com.github.kagkarlsson.scheduler.Scheduler scheduler)
Scheduler
used for scheduling and triggering purposes of deadlines. It should have either
the DbSchedulerDeadlineManager.binaryTask(Supplier)
or the DbSchedulerDeadlineManager.humanReadableTask(Supplier)
from this class as one of its
tasks to work. Which one depends on the setting of useBinaryPojo
. When true
, use
DbSchedulerDeadlineManager.binaryTask(Supplier)
else DbSchedulerDeadlineManager.humanReadableTask(Supplier)
. Depending on you application, you
can manage when to start the scheduler, or leave startScheduler
to true, to start it via the
Lifecycle
.scheduler
- a Scheduler
used for scheduling and triggering purposes of the deadlinespublic DbSchedulerDeadlineManager.Builder scopeAwareProvider(ScopeAwareProvider scopeAwareProvider)
ScopeAwareProvider
which is capable of providing a stream of
Scope
instances for a given ScopeDescriptor
. Used to return the
right Scope to trigger a deadline in.scopeAwareProvider
- a ScopeAwareProvider
used to find the right
Scope
to trigger a deadline inpublic DbSchedulerDeadlineManager.Builder serializer(Serializer serializer)
Serializer
used to de-/serialize the payload
,
MetaData
and the ScopeDescriptor
into the DeadlineDetails
as well as the whole DeadlineDetails
itself.serializer
- a Serializer
used to de-/serialize the payload
,
MetaData
and the ScopeDescriptor
into the
DeadlineDetails
, as well as the whole DeadlineDetails
itself.public DbSchedulerDeadlineManager.Builder transactionManager(TransactionManager transactionManager)
TransactionManager
used to build transactions and ties them to deadline. Defaults to a
NoTransactionManager
.transactionManager
- a TransactionManager
used to build transactions and ties them to deadline@Deprecated public DbSchedulerDeadlineManager.Builder spanFactory(@Nonnull SpanFactory spanFactory)
spanFactory(DeadlineManagerSpanFactory)
instead as it provides more configuration options.SpanFactory
implementation to use for providing tracing capabilities. Defaults to a
NoOpSpanFactory
by default, which provides no tracing capabilities.spanFactory
- The SpanFactory
implementationpublic DbSchedulerDeadlineManager.Builder spanFactory(@Nonnull DeadlineManagerSpanFactory spanFactory)
DeadlineManagerSpanFactory
implementation to use for providing tracing capabilities.
Defaults to a DefaultDeadlineManagerSpanFactory
backed by a NoOpSpanFactory
by default, which
provides no tracing capabilities.spanFactory
- The DeadlineManagerSpanFactory
implementationpublic DbSchedulerDeadlineManager.Builder useBinaryPojo(boolean useBinaryPojo)
DbSchedulerBinaryEventData
, compared to a pojo
optimized for readability, DbSchedulerEventScheduler
.useBinaryPojo
- a boolean
to determine whether to use a binary format.public DbSchedulerDeadlineManager.Builder startScheduler(boolean startScheduler)
Scheduler
using the Lifecycle
, or to never start the scheduler from
this component instead. defaults to true
.startScheduler
- a boolean
to determine whether to start the scheduler.public DbSchedulerDeadlineManager.Builder stopScheduler(boolean stopScheduler)
Scheduler
using the Lifecycle
, or to never stop the scheduler from
this component instead. defaults to true
.stopScheduler
- a boolean
to determine whether to start the scheduler.public DbSchedulerDeadlineManager build()
DbSchedulerDeadlineManager
as specified through this Builder.DbSchedulerDeadlineManager
as specified through this Builderprotected void validate() throws AxonConfigurationException
AxonConfigurationException
- if one field is asserted to be incorrect according to the Builder's
specificationsCopyright © 2010–2024. All rights reserved.