Class SpringSagaDescriptor
- All Implemented Interfaces:
EventProcessorDefinition.EventHandlerDescriptor,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware
SagaProcessorConfigurer needs to assemble that Saga's event processor.
Implements EventProcessorDefinition.EventHandlerDescriptor so that an
EventProcessorDefinition's handler selector can pick a Saga the same way it picks an ordinary event
handler bean. The Saga itself is assembled separately from ordinary handlers, though: see
SagaProcessorConfigurer.
This class is internal wiring created by SpringSagaLookup. Spring discovers only the Saga type; Axon creates
Saga instances itself, without applying Spring bean post-processors or injecting Saga fields.
- Since:
- 5.4.0
- Author:
- Allard Buijze, Mateusz Nowak
-
Constructor Summary
ConstructorsConstructorDescriptionSpringSagaDescriptor(Class<?> sagaType) Initializes a descriptor for the given Saga type.SpringSagaDescriptor(String sagaBeanName, Class<?> sagaType, Supplier<org.springframework.beans.factory.config.BeanDefinition> sagaBeanDefinitionSupplier) Initializes a descriptor for a discovered Saga bean. -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.beans.factory.config.BeanDefinitionReturns the SpringBeanDefinitionfor this event handler.beanName()Returns the Spring bean name of this event handler.Class<?> beanType()Returns the Java type of this event handler bean.Returns the component builder for this event handler.Always throws, because a Saga has no single bean instance to resolve.voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetSagaStore(String sagaStore) Sets the name of theSagaStorebean the Sagas of this type are kept in.
-
Constructor Details
-
SpringSagaDescriptor
Initializes a descriptor for the given Saga type.- Parameters:
sagaType- the Saga type to configure
-
SpringSagaDescriptor
public SpringSagaDescriptor(String sagaBeanName, Class<?> sagaType, Supplier<org.springframework.beans.factory.config.BeanDefinition> sagaBeanDefinitionSupplier) Initializes a descriptor for a discovered Saga bean.- Parameters:
sagaBeanName- the Spring bean name used for discovery and processor selectorssagaType- the Saga type to configuresagaBeanDefinitionSupplier- supplies the original Spring bean definition without making Spring treat it as an inner bean
-
-
Method Details
-
setSagaStore
Sets the name of theSagaStorebean the Sagas of this type are kept in.- Parameters:
sagaStore- the name of the Saga store bean
-
beanName
Description copied from interface:EventProcessorDefinition.EventHandlerDescriptorReturns the Spring bean name of this event handler.- Specified by:
beanNamein interfaceEventProcessorDefinition.EventHandlerDescriptor- Returns:
- The bean name.
-
beanDefinition
public org.springframework.beans.factory.config.BeanDefinition beanDefinition()Description copied from interface:EventProcessorDefinition.EventHandlerDescriptorReturns the SpringBeanDefinitionfor this event handler.- Specified by:
beanDefinitionin interfaceEventProcessorDefinition.EventHandlerDescriptor- Returns:
- The bean definition.
-
beanType
Description copied from interface:EventProcessorDefinition.EventHandlerDescriptorReturns the Java type of this event handler bean.- Specified by:
beanTypein interfaceEventProcessorDefinition.EventHandlerDescriptor- Returns:
- The bean type.
-
resolveBean
Always throws, because a Saga has no single bean instance to resolve.Spring never instantiates a Saga: instances are created and loaded per Saga identifier by the Saga manager. Returning a fresh throwaway instance here would look like the bean an
EventProcessorDefinitionselector asked for while belonging to no Saga at all. Select a Saga onbeanName()orbeanType()instead.- Specified by:
resolveBeanin interfaceEventProcessorDefinition.EventHandlerDescriptor- Returns:
- The event handler bean.
- Throws:
UnsupportedOperationException- always
-
component
Description copied from interface:EventProcessorDefinition.EventHandlerDescriptorReturns the component builder for this event handler.- Specified by:
componentin interfaceEventProcessorDefinition.EventHandlerDescriptor- Returns:
- The component builder.
-
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
-