Package org.axonframework.deadline
Class SimpleDeadlineManager.Builder
java.lang.Object
org.axonframework.deadline.SimpleDeadlineManager.Builder
- Enclosing class:
SimpleDeadlineManager
Builder class to instantiate a
SimpleDeadlineManager.
The ScheduledExecutorService is defaulted to an Executors.newSingleThreadScheduledExecutor()
which contains an AxonThreadFactory. The ScopeAwareProvider and the UnitOfWorkFactory are
hard requirements and as such should be provided.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Initializes aSimpleDeadlineManageras specified through this Builder.scheduledExecutorService(ScheduledExecutorService scheduledExecutorService) Sets theScheduledExecutorServiceused for scheduling and triggering 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
-
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
-
scheduledExecutorService
public SimpleDeadlineManager.Builder scheduledExecutorService(ScheduledExecutorService scheduledExecutorService) Sets theScheduledExecutorServiceused for scheduling and triggering deadlines. Defaults to aExecutors.newSingleThreadScheduledExecutor(), containing anAxonThreadFactory.- Parameters:
scheduledExecutorService- aScheduledExecutorServiceused for scheduling and triggering deadlines- 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
-
build
Initializes aSimpleDeadlineManageras specified through this Builder.- Returns:
- a
SimpleDeadlineManageras 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
-