Class LegacyScopeAwareProvider

java.lang.Object
org.axonframework.messaging.LegacyScopeAwareProvider
All Implemented Interfaces:
ScopeAwareProvider

public class LegacyScopeAwareProvider extends Object implements ScopeAwareProvider
The ScopeAwareProvider of a configuration, providing the ScopeAware components that a fired deadline is delivered to: the Saga managers, and the component translating an aggregate's deadline into a command.

The configuration creates this provider through the LegacyScopeAwareProviderConfigurationEnhancer, and the components register themselves with it as the configuration builds them. Applications do not create a provider. A deadline manager uses the configuration's provider instead: in Spring, by autowiring the ScopeAwareProvider bean, and otherwise through the configuration:


 JobRunrDeadlineManager.builder()
                       .scopeAwareProvider(configuration.getComponent(ScopeAwareProvider.class))
                       // ...
                       .build();
 
Axon Framework builds a Saga manager when the event processor handling its Saga starts. A persistent deadline manager may fire an overdue deadline before that. Until the configuration has started its event processors, this provider therefore waits before it provides any component, at most for the readiness timeout. After that, it throws a ScopeAwareProviderNotReadyException, upon which the deadline manager retries the deadline.
Since:
5.4.0
Author:
Jakob Hatzl
  • Method Details

    • register

      public void register(ScopeAware scopeAware)
      Registers the given scopeAware component, so that this provider provides it to fired deadlines.
      Parameters:
      scopeAware - the component to provide to fired deadlines
    • provideScopeAwareStream

      public Stream<ScopeAware> provideScopeAwareStream(ScopeDescriptor scopeDescriptor)
      Retrieve a Stream of ScopeAware components, by performing a check whether that component is able to handle a Scope described by a ScopeDescriptor.

      Provides every registered component once the configuration has started its event processors. Before that, it waits at most for the readiness timeout.

      Specified by:
      provideScopeAwareStream in interface ScopeAwareProvider
      Parameters:
      scopeDescriptor - a ScopeDescriptor describing the Scope a component ScopeAware should be able to handle
      Returns:
      a Stream of ScopeAware components
      Throws:
      ScopeAwareProviderNotReadyException - if the configuration did not start within the readiness timeout, or shut down without starting