Class QuartzDeadlineManager.Builder
java.lang.Object
org.axonframework.deadline.quartz.QuartzDeadlineManager.Builder
- Enclosing class:
QuartzDeadlineManager
Builder class to instantiate a
QuartzDeadlineManager.
The refire policy defaults to refiring immediately for every failure that is not an
AxonNonTransientException. The Scheduler, ScopeAwareProvider, UnitOfWorkFactory
and Converter are hard requirements and as such should be provided.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Initializes aQuartzDeadlineManageras specified through this Builder.Sets theConverterused to convert the payload, metadata andScopeDescriptorof a deadline to and from theJobDataMap.refireImmediatelyPolicy(Predicate<Throwable> refireImmediatelyPolicy) Sets aPredicatetaking aThrowableto decide whether a failedDeadlineJobshould be 'refired' immediately.scheduler(org.quartz.Scheduler scheduler) Sets theSchedulerused for scheduling and triggering purposes of the deadlines.scopeAwareProvider(ScopeAwareProvider scopeAwareProvider) Sets theScopeAwareProviderwhich is capable of providing a stream ofScopeinstances for a givenScopeDescriptor.unitOfWorkFactory(UnitOfWorkFactory unitOfWorkFactory) Sets theUnitOfWorkFactorycreating the unit of work a fired deadline runs in.protected voidvalidate()Validates whether the fields contained in this Builder are set accordingly.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
scheduler
Sets theSchedulerused for scheduling and triggering purposes of the deadlines.- 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 theJobDataMap. To keep reading jobs scheduled by Axon Framework 4, it has to match the serializer the Axon Framework 4 deadline manager used, such as aJacksonConverterfor aJacksonSerializer.- Parameters:
converter- theConverterused to convert the deadline's data to and from the job data- Returns:
- the current Builder instance, for fluent interfacing
-
refireImmediatelyPolicy
public QuartzDeadlineManager.Builder refireImmediatelyPolicy(Predicate<Throwable> refireImmediatelyPolicy) Sets aPredicatetaking aThrowableto decide whether a failedDeadlineJobshould be 'refired' immediately. Defaults to a Predicate which will refire immediately on non-AxonNonTransientExceptions.- Parameters:
refireImmediatelyPolicy- aPredicatetaking aThrowableto decide whether a failedDeadlineJobshould be 'refired' immediately- Returns:
- the current Builder instance, for fluent interfacing
-
build
Initializes aQuartzDeadlineManageras specified through this Builder.- Returns:
- a
QuartzDeadlineManageras 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
-