Interface Configuration

All Superinterfaces:
LifecycleOperations
All Known Implementing Classes:
AxonConfiguration

public interface Configuration extends LifecycleOperations
Interface describing the Global Configuration for Axon components. It provides access to the components configured, such as the Command Bus and Event Bus.

Note that certain components in the Configuration may need to be started. Therefore, before using any of the components provided by this configuration, ensure that start() has been invoked.

Since:
3.0
Author:
Allard Buijze
  • Method Details

    • eventBus

      default EventBus eventBus()
      Retrieves the Event Bus defined in this Configuration.
      Returns:
      the Event Bus defined in this Configuration
    • lifecycleRegistry

      default Lifecycle.LifecycleRegistry lifecycleRegistry()
      Returns the lifecycle registry for this configuration. Typically, this is just an adapter around the configuration itself to register individual handler methods.
      Returns:
      the lifecycle registry for this configuration
    • eventStore

      default EventStore eventStore()
      Returns the Event Store in this Configuration, if it is defined. If no Event Store is defined (but an Event Bus instead), this method throws an AxonConfigurationException.
      Returns:
      the Event Store defined in this Configuration
    • findModules

      default <T extends ModuleConfiguration> List<T> findModules(@Nonnull Class<T> moduleType)
      Finds all configuration modules of given moduleType within this configuration.
      Type Parameters:
      T - The type of the configuration module
      Parameters:
      moduleType - The type of the configuration module
      Returns:
      configuration modules of moduleType defined in this configuration
    • commandBus

      default CommandBus commandBus()
      Returns the Command Bus defined in this Configuration. Note that this Configuration should be started (see start()) before sending Commands over the Command Bus.
      Returns:
      the CommandBus defined in this configuration
    • queryBus

      default QueryBus queryBus()
    • queryUpdateEmitter

      default QueryUpdateEmitter queryUpdateEmitter()
      Returns the Query Update Emitter in this Configuration. Note that this Configuration should be started (see start() before emitting updates over Query Update Emitter.
      Returns:
      the QueryUpdateEmitter defined in this configuration
    • resourceInjector

      default ResourceInjector resourceInjector()
      Returns the ResourceInjector used to provide resources to Saga instances.
      Returns:
      the ResourceInjector used to provide resources to Saga instances
    • commandGateway

      default CommandGateway commandGateway()
      Returns the Command Gateway defined in this Configuration. Note that this Configuration should be started (see start()) before sending Commands using this Command Gateway.
      Returns:
      the CommandGateway defined in this configuration
    • eventProcessingConfiguration

      default EventProcessingConfiguration eventProcessingConfiguration() throws AxonConfigurationException
      Returns the EventProcessingConfiguration defined in this Configuration. If there aren't any defined, null will be returned. If there is exactly one, it will be returned. For case when there are multiple, an AxonConfigurationException is thrown and the getModules() API should be used instead.
      Returns:
      the EventProcessingConfiguration defined in this Configuration
      Throws:
      AxonConfigurationException - thrown if there are more than one Event Processing Configurations defined with this configuration
    • queryGateway

      default QueryGateway queryGateway()
      Returns the Query Gateway defined in this Configuration. Note that this Configuration should be started (see start()) before sending Queries using this Query Gateway.
      Returns:
      the QueryGateway defined in this configuration
    • eventGateway

      default EventGateway eventGateway()
      Returns the Event Gateway defined in this Configuration.
      Returns:
      the EventGateway defined in this configuration
    • tags

      default TagsConfiguration tags()
      Returns the Tags Configuration defined in this Configuration.
      Returns:
      the Tags Configuration defined in this Configuration
    • spanFactory

      default SpanFactory spanFactory()
      Returns the SpanFactory defined in this configuration.
      Returns:
      the SpanFactory defined in this configuration.
    • aggregateConfiguration

      default <A> AggregateConfiguration<A> aggregateConfiguration(@Nonnull Class<A> aggregateType)
      Returns the AggregateConfiguration for the given aggregateType.
      Type Parameters:
      A - the aggregate type
      Parameters:
      aggregateType - the aggregate type to find the AggregateConfiguration for
      Returns:
      the AggregateConfiguration for the given aggregateType
    • repository

      default <A> Repository<A> repository(@Nonnull Class<A> aggregateType)
      Returns the Repository configured for the given aggregateType.
      Type Parameters:
      A - the aggregate type
      Parameters:
      aggregateType - the aggregate type to find the Repository for
      Returns:
      the Repository from which aggregates of the given aggregateType can be loaded
    • aggregateFactory

      default <A> AggregateFactory<A> aggregateFactory(@Nonnull Class<A> aggregateType)
      Returns the AggregateFactory configured for the given aggregateType.
      Type Parameters:
      A - the aggregate type
      Parameters:
      aggregateType - the aggregate type to find the AggregateFactory for
      Returns:
      the AggregateFactory which constructs aggregate of the given aggregateType
    • getComponent

      default <T> T getComponent(@Nonnull Class<T> componentType)
      Returns the Component declared under the given componentType, typically the interface the component implements.
      Type Parameters:
      T - The type of component
      Parameters:
      componentType - The type of component
      Returns:
      the component registered for the given type, or null if no such component exists
    • getComponent

      <T> T getComponent(@Nonnull Class<T> componentType, @Nonnull Supplier<T> defaultImpl)
      Returns the Component declared under the given componentType, typically the interface the component implements, reverting to the given defaultImpl if no such component is defined.

      When no component was previously registered, the default is then configured as the component for the given type.

      Type Parameters:
      T - The type of component
      Parameters:
      componentType - The type of component
      defaultImpl - The supplier of the default to return if no component was registered
      Returns:
      the component registered for the given type, or the value returned by the defaultImpl supplier, if no component was registered
    • messageMonitor

      <M extends Message<?>> MessageMonitor<? super M> messageMonitor(@Nonnull Class<?> componentType, @Nonnull String componentName)
      Returns the message monitor configured for a component of given componentType and componentName.
      Type Parameters:
      M - The type of message the monitor can deal with
      Parameters:
      componentType - The type of component to return the monitor for
      componentName - The name of the component
      Returns:
      The monitor to be used for the described component
    • serializer

      default Serializer serializer()
      Returns the serializer defined in this Configuration
      Returns:
      the serializer defined in this Configuration
    • eventSerializer

      Serializer eventSerializer()
      Returns the Serializer defined in this Configuration to be used for serializing Event Message payload and their metadata.
      Returns:
      the event serializer defined in this Configuration.
    • messageSerializer

      Serializer messageSerializer()
      Returns the Serializer defined in this Configuration to be used for serializing Message payloads and metadata.
      Returns:
      the message serializer defined in this Configuration.
    • start

      void start()
      Starts this configuration. All components defined in this Configuration will be started.
    • shutdown

      void shutdown()
      Shuts down the components defined in this Configuration
    • correlationDataProviders

      List<CorrelationDataProvider> correlationDataProviders()
      Returns the Correlation Data Providers defined in this Configuration.
      Returns:
      the Correlation Data Providers defined in this Configuration
    • parameterResolverFactory

      default ParameterResolverFactory parameterResolverFactory()
      Returns the Parameter Resolver Factory defined in this Configuration
      Returns:
      the Parameter Resolver Factory defined in this Configuration
    • handlerDefinition

      HandlerDefinition handlerDefinition(Class<?> inspectedType)
      Returns the Handler Definition defined in this Configuration for the given inspectedType.
      Parameters:
      inspectedType - The class to being inspected for handlers
      Returns:
      the Handler Definition defined in this Configuration
    • eventScheduler

      default EventScheduler eventScheduler()
      Returns the EventScheduler defined in this Configuration.
      Returns:
      the EventScheduler defined in this Configuration
    • deadlineManager

      default DeadlineManager deadlineManager()
      Returns the DeadlineManager defined in this Configuration.
      Returns:
      the DeadlineManager defined in this Configuration
    • snapshotter

      default Snapshotter snapshotter()
      Returns the Snapshotter defined in this Configuration.
      Returns:
      the Snapshotter defined in this Configuration
    • scopeAwareProvider

      default ScopeAwareProvider scopeAwareProvider()
      Returns the ScopeAwareProvider defined in the Configuration.
      Returns:
      the ScopeAwareProvider defined in the Configuration
    • getModules

      List<ModuleConfiguration> getModules()
      Returns all modules that have been registered with this Configuration.
      Returns:
      all modules that have been registered with this Configuration
    • upcasterChain

      EventUpcasterChain upcasterChain()
      Returns the EventUpcasterChain with all registered upcasters.
      Returns:
      the EventUpcasterChain with all registered upcasters
    • snapshotFilter

      default SnapshotFilter snapshotFilter()
      Returns the SnapshotFilter combining all defined filters per AggregateConfigurer in an SnapshotFilter.combine(SnapshotFilter) operation.
      Returns:
      the SnapshotFilter combining all defined filters per AggregateConfigurer