Class SagaProcessorConfigurer
- All Implemented Interfaces:
ConfigurationEnhancer,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware
Sagas are assembled here rather than through DefaultProcessorModuleFactory, deliberately. Everything Saga
support needs -- registering an already assembled Saga manager instead of inspecting a bean for annotated handler
methods, deriving a <SagaName>Processor name, and starting a Saga's processor at the head of the stream --
would otherwise have to be threaded as Saga-shaped hooks through the processor factory and the handler discovery
that every Axon Framework 5 Spring application relies on. Saga support is a migration aid with a limited life, so
it pays for its own assembly instead: this class duplicates a modest amount of DefaultProcessorModuleFactory,
and both the duplicate and the rest of Saga support are deleted together with axon-legacy.
The one behavioural consequence is that a Saga and an ordinary event handler can no longer share a processor, as
they could under a single @ProcessingGroup in Axon Framework 4. Both pipelines register a module named after
the processor, so a collision surfaces at startup as a
DuplicateModuleRegistrationException rather than as a silent merge.
Several Sagas resolving to the same name do still share one processor.
Processor settings and EventProcessorDefinitions apply to a Saga's processor as they apply to any other,
because this class reads the same beans the regular pipeline reads.
PooledStreamingEventProcessorModule.Customization beans are the exception: they are deliberately not
applied to a Saga's processor. That channel is how cross-cutting Axon Framework 5 infrastructure attaches itself
to every processor in an application -- dead-lettering, for one, is enabled by a Customization bean that puts a
dead letter queue extension on the processor configuration -- and Axon Framework 4 never dead-lettered a Saga: it
never wrapped a Saga manager in its dead-lettering invoker. Silently acquiring behaviour the original never had is
the opposite of what a migration aid should do, so a Saga processor opts out of the channel as a whole rather than
guessing which customization means well.
Declare a SagaProcessorDefinition bean instead. It is the same capability scoped to Sagas, so no Axon
Framework 5 extension can arrive through it, and it neither assigns handlers nor fixes the processor's mode the
way an EventProcessorDefinition does. An EventProcessorDefinition naming the processor still
applies as well, for an application that wants to configure a Saga's processor the same way it configures every
other one.
Registered as a bean by the Saga auto configuration; an application never creates this itself.
- Since:
- 5.4.0
- Author:
- Mateusz Nowak
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidenhance(ComponentRegistry registry) voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.axonframework.common.configuration.ConfigurationEnhancer
order
-
Constructor Details
-
SagaProcessorConfigurer
public SagaProcessorConfigurer()
-
-
Method Details
-
enhance
Description copied from interface:ConfigurationEnhancer- Specified by:
enhancein interfaceConfigurationEnhancer- Parameters:
registry- The registry instance to enhance.
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-