public class SagaConfiguration<S> extends Object implements ModuleConfiguration
Modifier and Type | Method and Description |
---|---|
SagaConfiguration<S> |
configureSagaStore(Function<Configuration,SagaStore<? super S>> sagaStoreBuilder)
Configures the Saga Store to use to store Saga instances of this type.
|
EventProcessor |
getProcessor()
Returns the processor that processed events for the Saga in this Configuration.
|
AnnotatedSagaManager<S> |
getSagaManager()
Returns the SagaManager responsible for managing the lifecycle and invocation of Saga instances of the type
defined in this Configuration
|
SagaRepository<S> |
getSagaRepository()
Returns the SagaRepository instance used to load Saga instances in this Configuration.
|
SagaStore<? super S> |
getSagaStore()
Returns the Saga Store used by the Saga defined in this Configuration.
|
void |
initialize(Configuration config)
Initialize the module configuration using the given global
config |
SagaConfiguration<S> |
registerHandlerInterceptor(Function<Configuration,MessageHandlerInterceptor<? super EventMessage<?>>> handlerInterceptorBuilder)
Registers the handler interceptor provided by the given
handlerInterceptorBuilder function with
the processor defined in this configuration. |
void |
shutdown()
Invoked prior to shutdown of the application.
|
void |
start()
Invoked when the Configuration is started.
|
static <S> SagaConfiguration<S> |
subscribingSagaManager(Class<S> sagaType)
Initialize a configuration for a Saga of given
sagaType , using a Subscribing Event Processor to process
incoming Events. |
static <S> SagaConfiguration<S> |
subscribingSagaManager(Class<S> sagaType,
Function<Configuration,SubscribableMessageSource<EventMessage<?>>> messageSourceBuilder)
Initialize a configuration for a Saga of given
sagaType , using a Subscribing Event Processor to process
incoming Events from the message source provided by given messageSourceBuilder |
static <S> SagaConfiguration<S> |
trackingSagaManager(Class<S> sagaType)
Initialize a configuration for a Saga of given
sagaType , using a Tracking Event Processor to process
incoming Events. |
static <S> SagaConfiguration<S> |
trackingSagaManager(Class<S> sagaType,
Function<Configuration,StreamableMessageSource<TrackedEventMessage<?>>> messageSourceBuilder)
Initialize a configuration for a Saga of given
sagaType , using a Tracking Event Processor to process
incoming Events from a Message Source provided by given messageSourceBuilder . |
public static <S> SagaConfiguration<S> subscribingSagaManager(Class<S> sagaType)
sagaType
, using a Subscribing Event Processor to process
incoming Events.S
- The type of Saga configured in this configurationsagaType
- The type of Saga to handle events withpublic static <S> SagaConfiguration<S> subscribingSagaManager(Class<S> sagaType, Function<Configuration,SubscribableMessageSource<EventMessage<?>>> messageSourceBuilder)
sagaType
, using a Subscribing Event Processor to process
incoming Events from the message source provided by given messageSourceBuilder
S
- The type of Saga configured in this configurationsagaType
- The type of Saga to handle events withmessageSourceBuilder
- The function providing the message source based on the configurationpublic static <S> SagaConfiguration<S> trackingSagaManager(Class<S> sagaType)
sagaType
, using a Tracking Event Processor to process
incoming Events. Note that a Token Store should be configured in the global configuration, or the Saga Manager
will default to an in-memory token store, which is not recommended for production environments.S
- The type of Saga configured in this configurationsagaType
- The type of Saga to handle events withpublic static <S> SagaConfiguration<S> trackingSagaManager(Class<S> sagaType, Function<Configuration,StreamableMessageSource<TrackedEventMessage<?>>> messageSourceBuilder)
sagaType
, using a Tracking Event Processor to process
incoming Events from a Message Source provided by given messageSourceBuilder
. Note that a Token Store
should be configured in the global configuration, or the Saga Manager will default to an in-memory token store,
which is not recommended for production environments.S
- The type of Saga configured in this configurationsagaType
- The type of Saga to handle events withmessageSourceBuilder
- The function providing the message source based on the configurationpublic SagaConfiguration<S> configureSagaStore(Function<Configuration,SagaStore<? super S>> sagaStoreBuilder)
sagaStoreBuilder
- The builder that returnes a fully initialized Saga Store instance based on the global
Configurationpublic SagaConfiguration<S> registerHandlerInterceptor(Function<Configuration,MessageHandlerInterceptor<? super EventMessage<?>>> handlerInterceptorBuilder)
handlerInterceptorBuilder
function with
the processor defined in this configuration.handlerInterceptorBuilder
- The function to create the interceptor based on the current configurationpublic void initialize(Configuration config)
ModuleConfiguration
config
initialize
in interface ModuleConfiguration
config
- the global configuration, providing access to generic componentspublic void start()
ModuleConfiguration
start
in interface ModuleConfiguration
Configuration.start()
public EventProcessor getProcessor()
IllegalStateException
- when this configuration hasn't been initialized yetpublic SagaStore<? super S> getSagaStore()
IllegalStateException
- when this configuration hasn't been initialized yetpublic SagaRepository<S> getSagaRepository()
IllegalStateException
- when this configuration hasn't been initialized yetpublic AnnotatedSagaManager<S> getSagaManager()
IllegalStateException
- when this configuration hasn't been initialized yetpublic void shutdown()
ModuleConfiguration
shutdown
in interface ModuleConfiguration
Configuration.shutdown()
Copyright © 2010–2017. All rights reserved.