Class QuartzDeadlineManager.Builder

java.lang.Object
org.axonframework.deadline.quartz.QuartzDeadlineManager.Builder
Enclosing class:
QuartzDeadlineManager

public static class QuartzDeadlineManager.Builder extends Object
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 Details

    • Builder

      public Builder()
  • Method Details

    • scheduler

      public QuartzDeadlineManager.Builder scheduler(org.quartz.Scheduler scheduler)
      Sets the Scheduler used for scheduling and triggering purposes of the deadlines.
      Parameters:
      scheduler - a Scheduler used for scheduling and triggering purposes of the deadlines
      Returns:
      the current Builder instance, for fluent interfacing
    • scopeAwareProvider

      public QuartzDeadlineManager.Builder scopeAwareProvider(ScopeAwareProvider scopeAwareProvider)
      Sets the 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.
      Parameters:
      scopeAwareProvider - a ScopeAwareProvider used to find the right Scope to trigger a deadline in
      Returns:
      the current Builder instance, for fluent interfacing
    • unitOfWorkFactory

      public QuartzDeadlineManager.Builder unitOfWorkFactory(UnitOfWorkFactory unitOfWorkFactory)
      Sets the UnitOfWorkFactory creating 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 a ProcessingContext that 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

      public QuartzDeadlineManager.Builder converter(Converter converter)
      Sets the Converter used to convert the payload, metadata and ScopeDescriptor of a deadline to and from the JobDataMap. To keep reading jobs scheduled by Axon Framework 4, it has to match the serializer the Axon Framework 4 deadline manager used, such as a JacksonConverter for a JacksonSerializer.
      Parameters:
      converter - the Converter used 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 a Predicate taking a Throwable to decide whether a failed DeadlineJob should be 'refired' immediately. Defaults to a Predicate which will refire immediately on non-AxonNonTransientExceptions.
      Parameters:
      refireImmediatelyPolicy - a Predicate taking a Throwable to decide whether a failed DeadlineJob should be 'refired' immediately
      Returns:
      the current Builder instance, for fluent interfacing
    • build

      public QuartzDeadlineManager build()
      Initializes a QuartzDeadlineManager as specified through this Builder.
      Returns:
      a QuartzDeadlineManager as specified through this Builder
    • validate

      protected void validate() throws AxonConfigurationException
      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