Class AbstractSagaManager.Builder<T>

java.lang.Object
org.axonframework.modelling.saga.AbstractSagaManager.Builder<T>
Type Parameters:
T - a generic specifying the Saga type managed by this implementation
Direct Known Subclasses:
AnnotatedSagaManager.Builder
Enclosing class:
AbstractSagaManager<T>

public abstract static class AbstractSagaManager.Builder<T> extends Object
Abstract Builder class to instantiate AbstractSagaManager implementations.

The sagaFactory is defaulted to a sagaType.newInstance() call throwing a SagaInstantiationException if it fails. The SagaRepository and sagaType are hard requirements and as such should be provided.

  • Field Details

    • sagaType

      protected Class<T> sagaType
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • sagaRepository

      public AbstractSagaManager.Builder<T> sagaRepository(SagaRepository<T> sagaRepository)
      Sets the SagaRepository of generic type T used to save and load Saga instances.
      Parameters:
      sagaRepository - a SagaRepository of generic type T used to save and load Saga instances
      Returns:
      the current Builder instance, for fluent interfacing
    • sagaType

      public AbstractSagaManager.Builder<T> sagaType(Class<T> sagaType)
      Sets the sagaType as a Class managed by this instance.
      Parameters:
      sagaType - the Class specifying the type of Saga managed by this instance
      Returns:
      the current Builder instance, for fluent interfacing
    • sagaFactory

      public AbstractSagaManager.Builder<T> sagaFactory(Supplier<T> sagaFactory)
      Sets the sagaFactory of type Supplier responsible for creating new Saga instances. Defaults to a sagaType.newInstance() call throwing a SagaInstantiationException if it fails.
      Parameters:
      sagaFactory - a Supplier of Saga type T responsible for creating new Saga instances
      Returns:
      the current Builder instance, for fluent interfacing
    • 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