Class DbSchedulerDeadlineManager.Builder
java.lang.Object
org.axonframework.deadline.dbscheduler.DbSchedulerDeadlineManager.Builder
- Enclosing class:
DbSchedulerDeadlineManager
Builder class to instantiate a
DbSchedulerDeadlineManager.
The useBinaryPojo, startScheduler and stopScheduler settings are defaulted to
true. The Scheduler, ScopeAwareProvider, UnitOfWorkFactory and Converter
are hard requirements and as such should be provided.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Initializes aDbSchedulerDeadlineManageras specified through this Builder.Sets theConverterused to convert the payload, metadata andScopeDescriptorof a deadline to and from their stored form in the task data.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.startScheduler(boolean startScheduler) Sets whetherDbSchedulerDeadlineManager.start()starts theScheduler, or leaves starting it to the application.stopScheduler(boolean stopScheduler) Sets whetherDbSchedulerDeadlineManager.shutdown()stops theScheduler, or leaves stopping it to the application.unitOfWorkFactory(UnitOfWorkFactory unitOfWorkFactory) Sets theUnitOfWorkFactorycreating the unit of work a fired deadline runs in.useBinaryPojo(boolean useBinaryPojo) Sets whether to use a pojo optimized for size,DbSchedulerBinaryDeadlineDetails, compared to a pojo optimized for readability,DbSchedulerHumanReadableDeadlineDetails.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).- 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
-
unitOfWorkFactory
Sets theUnitOfWorkFactorycreating the unit of work a fired deadline runs in. Pass the factory of the application's configuration, so that a fired deadline runs in the same kind of unit of work as other messages: transactional if the factory is, and with aProcessingContextthat resolves components.- Parameters:
unitOfWorkFactory- the factory creating the unit of work a fired deadline runs in- Returns:
- the current Builder instance, for fluent interfacing
-
converter
Sets theConverterused to convert the payload, metadata andScopeDescriptorof a deadline to and from their stored form in the task data. To keep reading tasks scheduled by Axon Framework 4, it has to match the serializer the Axon Framework 4 deadline manager used, such as aJacksonConverterfor aJacksonSerializer. For a manager that Axon Framework 4's Spring Boot auto-configuration built, that is the counterpart of the event serializer, theEventConverter.- Parameters:
converter- theConverterused to convert the deadline's parts- Returns:
- the current Builder instance, for fluent interfacing
-
useBinaryPojo
Sets whether to use a pojo optimized for size,DbSchedulerBinaryDeadlineDetails, compared to a pojo optimized for readability,DbSchedulerHumanReadableDeadlineDetails. Defaults totrue.- Parameters:
useBinaryPojo- abooleanto determine whether to use a binary format- Returns:
- the current Builder instance, for fluent interfacing
-
startScheduler
Sets whetherDbSchedulerDeadlineManager.start()starts theScheduler, or leaves starting it to the application. Defaults totrue.- Parameters:
startScheduler- abooleanto determine whether to start the scheduler- Returns:
- the current Builder instance, for fluent interfacing
-
stopScheduler
Sets whetherDbSchedulerDeadlineManager.shutdown()stops theScheduler, or leaves stopping it to the application. Defaults totrue.- Parameters:
stopScheduler- abooleanto determine whether to stop 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
-