Class DbSchedulerDeadlineManager.Builder
java.lang.Object
org.axonframework.deadline.dbscheduler.DbSchedulerDeadlineManager.Builder
- Enclosing class:
DbSchedulerDeadlineManager
Builder class to instantiate a
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Initializes aDbSchedulerDeadlineManageras specified through this Builder.scheduler(com.github.kagkarlsson.scheduler.Scheduler scheduler) Sets theSchedulerused for scheduling and triggering purposes of deadlines.scopeAwareProvider(ScopeAwareProvider scopeAwareProvider) Sets theScopeAwareProviderwhich is capable of providing a stream ofScopeinstances for a givenScopeDescriptor.serializer(Serializer serializer) Sets theSerializerused to de-/serialize thepayload,MetaDataand theScopeDescriptorinto theDeadlineDetailsas well as the wholeDeadlineDetailsitself.spanFactory(DeadlineManagerSpanFactory spanFactory) Sets theDeadlineManagerSpanFactoryimplementation to use for providing tracing capabilities.spanFactory(SpanFactory spanFactory) Deprecated.startScheduler(boolean startScheduler) Sets whether to start theSchedulerusing theLifecycle, or to never start the scheduler from this component instead. defaults totrue.stopScheduler(boolean stopScheduler) Sets whether to stop theSchedulerusing theLifecycle, or to never stop the scheduler from this component instead. defaults totrue.transactionManager(TransactionManager transactionManager) Sets theTransactionManagerused to build transactions and ties them to deadline.useBinaryPojo(boolean useBinaryPojo) Sets whether to use a pojo optimized for size,DbSchedulerBinaryEventData, compared to a pojo optimized for readability,DbSchedulerEventScheduler.protected voidvalidate()Validates whether the fields contained in this Builder are set accordingly.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
scheduler
public DbSchedulerDeadlineManager.Builder scheduler(com.github.kagkarlsson.scheduler.Scheduler scheduler) Sets theSchedulerused for scheduling and triggering purposes of deadlines. It should have either theDbSchedulerDeadlineManager.binaryTask(Supplier)or theDbSchedulerDeadlineManager.humanReadableTask(Supplier)from this class as one of its tasks to work. Which one depends on the setting ofuseBinaryPojo. Whentrue, useDbSchedulerDeadlineManager.binaryTask(Supplier)elseDbSchedulerDeadlineManager.humanReadableTask(Supplier). Depending on you application, you can manage when to start the scheduler, or leavestartSchedulerto true, to start it via theLifecycle.- Parameters:
scheduler- aSchedulerused for scheduling and triggering purposes of the deadlines- Returns:
- the current Builder instance, for fluent interfacing
-
scopeAwareProvider
Sets theScopeAwareProviderwhich is capable of providing a stream ofScopeinstances for a givenScopeDescriptor. Used to return the right Scope to trigger a deadline in.- Parameters:
scopeAwareProvider- aScopeAwareProviderused to find the rightScopeto trigger a deadline in- Returns:
- the current Builder instance, for fluent interfacing
-
serializer
Sets theSerializerused to de-/serialize thepayload,MetaDataand theScopeDescriptorinto theDeadlineDetailsas well as the wholeDeadlineDetailsitself.- Parameters:
serializer- aSerializerused to de-/serialize thepayload,MetaDataand theScopeDescriptorinto theDeadlineDetails, as well as the wholeDeadlineDetailsitself.- Returns:
- the current Builder instance, for fluent interfacing
-
transactionManager
Sets theTransactionManagerused to build transactions and ties them to deadline. Defaults to aNoTransactionManager.- Parameters:
transactionManager- aTransactionManagerused to build transactions and ties them to deadline- Returns:
- the current Builder instance, for fluent interfacing
-
spanFactory
Deprecated.UsespanFactory(DeadlineManagerSpanFactory)instead as it provides more configuration options.Sets theSpanFactoryimplementation to use for providing tracing capabilities. Defaults to aNoOpSpanFactoryby default, which provides no tracing capabilities.- Parameters:
spanFactory- TheSpanFactoryimplementation- Returns:
- The current Builder instance, for fluent interfacing.
-
spanFactory
public DbSchedulerDeadlineManager.Builder spanFactory(@Nonnull DeadlineManagerSpanFactory spanFactory) Sets theDeadlineManagerSpanFactoryimplementation to use for providing tracing capabilities. Defaults to aDefaultDeadlineManagerSpanFactorybacked by aNoOpSpanFactoryby default, which provides no tracing capabilities.- Parameters:
spanFactory- TheDeadlineManagerSpanFactoryimplementation- Returns:
- The current Builder instance, for fluent interfacing.
-
useBinaryPojo
Sets whether to use a pojo optimized for size,DbSchedulerBinaryEventData, compared to a pojo optimized for readability,DbSchedulerEventScheduler.- Parameters:
useBinaryPojo- abooleanto determine whether to use a binary format.- Returns:
- the current Builder instance, for fluent interfacing
-
startScheduler
Sets whether to start theSchedulerusing theLifecycle, or to never start the scheduler from this component instead. defaults totrue.- Parameters:
startScheduler- abooleanto determine whether to start the scheduler.- Returns:
- the current Builder instance, for fluent interfacing
-
stopScheduler
Sets whether to stop theSchedulerusing theLifecycle, or to never stop the scheduler from this component instead. defaults totrue.- Parameters:
stopScheduler- abooleanto determine whether to start the scheduler.- Returns:
- the current Builder instance, for fluent interfacing
-
build
Initializes aDbSchedulerDeadlineManageras specified through this Builder.- Returns:
- a
DbSchedulerDeadlineManageras specified through this Builder
-
validate
Validates whether the fields contained in this Builder are set accordingly.- Throws:
AxonConfigurationException- if one field is asserted to be incorrect according to the Builder's specifications
-
spanFactory(DeadlineManagerSpanFactory)instead as it provides more configuration options.