Interface WorkflowModule.OptionalPhase<C extends WorkflowContext>
- Type Parameters:
C- the type ofWorkflowContextused by the workflows in this module
- All Superinterfaces:
Module,WorkflowModule<C>
- Enclosing interface:
WorkflowModule<C extends WorkflowContext>
definition(Function)- add another workflow definition to this module.processorConfiguration(Function)- customize thePooledStreamingEventProcessorConfigurationbacking this module's event processor.withHistory(ComponentBuilder)/withoutHistory()- enable or disable workflow history tracking.historyProcessorConfiguration(Function)- customize thePooledStreamingEventProcessorConfigurationbacking the history projector's own event processor.contextFactory(ComponentBuilder)- override theWorkflowContextFactoryused to create theWorkflowContextfor each workflow execution.configurationRegistry(ComponentBuilder)- override theWorkflowConfigurationRegistrystoring workflow configurations and their start conditions.executionRepository(ComponentBuilder)- override theWorkflowExecutionRepositorypersisting and retrieving workflow instances.
Reaching this phase already yields a fully-formed WorkflowModule.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.axoniq.framework.workflow.configuration.WorkflowModule
WorkflowModule.OptionalPhase<C extends WorkflowContext>, WorkflowModule.WorkflowDefinitionPhase<C extends WorkflowContext> -
Method Summary
Modifier and TypeMethodDescriptionconfigurationRegistry(ComponentBuilder<WorkflowConfigurationRegistry<?>> workflowConfigurationRegistry) Registers the givenComponentBuilderof aWorkflowConfigurationRegistryas the registry for the workflow module being built.contextFactory(ComponentBuilder<WorkflowContextFactory<C>> workflowContextFactory) Registers the givenComponentBuilderof aWorkflowContextFactoryas the context factory for the workflow module being built, overriding any factory a DSL module registered forWorkflowModule.contextType().definition(Function<WorkflowModule.WorkflowDefinitionPhase.DetectionPhase<C>, WorkflowModule.WorkflowDefinitionPhase.FinalizedPhase<C>> definition) Add another workflow definition to this module, which already received one or more via the fluentWorkflowModule.WorkflowDefinitionPhase.definition(Function)entry point.executionRepository(ComponentBuilder<WorkflowExecutionRepository> workflowExecutionRepository) Registers the givenComponentBuilderof aWorkflowExecutionRepositoryas the repository for the workflow module being built.historyProcessorConfiguration(Function<PooledStreamingEventProcessorConfiguration, PooledStreamingEventProcessorConfiguration> historyProcessorConfiguration) Applies the givenhistoryProcessorConfigurationfunction to thePooledStreamingEventProcessorConfigurationbacking the history projector's own, dedicated event processor.processorConfiguration(Function<PooledStreamingEventProcessorConfiguration, PooledStreamingEventProcessorConfiguration> processorConfiguration) Applies the givenprocessorConfigurationfunction to thePooledStreamingEventProcessorConfigurationbacking this module's event processor.withHistory(ComponentBuilder<MutableWorkflowHistoryRepository> workflowHistoryRepository) Enables workflow history tracking, storing collected history in the givenMutableWorkflowHistoryRepository.Disables workflow history tracking for this module.Methods inherited from interface io.axoniq.framework.workflow.configuration.WorkflowModule
contextType
-
Method Details
-
definition
WorkflowModule.OptionalPhase<C> definition(Function<WorkflowModule.WorkflowDefinitionPhase.DetectionPhase<C>, WorkflowModule.WorkflowDefinitionPhase.FinalizedPhase<C>> definition) Add another workflow definition to this module, which already received one or more via the fluentWorkflowModule.WorkflowDefinitionPhase.definition(Function)entry point.Use this to register multiple workflow definitions of the same workflow context type into a SINGLE module so they share one
WorkflowConfigurationRegistryandWorkflowEngine.- Parameters:
definition- function returning aWorkflowModule.WorkflowDefinitionPhase.FinalizedPhasefor an additional workflow- Returns:
- this phase, for further optional configuration
-
processorConfiguration
WorkflowModule.OptionalPhase<C> processorConfiguration(Function<PooledStreamingEventProcessorConfiguration, PooledStreamingEventProcessorConfiguration> processorConfiguration) Applies the givenprocessorConfigurationfunction to thePooledStreamingEventProcessorConfigurationbacking this module's event processor.Standard processor settings - segment count, batch size, error handling, worker executor, and so on - live on
PooledStreamingEventProcessorConfigurationitself. This method is the hook through which those settings are reached: the givenFunctionis applied on top of the module's own internal customization (event criteria, segment routing), so it composes with rather than replaces that wiring.The engine component name and the event processor's own name are not configurable - the module derives both from its own name, so several
WorkflowModules in one application never collide.- Parameters:
processorConfiguration- a function customizing thePooledStreamingEventProcessorConfigurationof this module's event processor- Returns:
- this phase, for further optional configuration
-
withHistory
WorkflowModule.OptionalPhase<C> withHistory(ComponentBuilder<MutableWorkflowHistoryRepository> workflowHistoryRepository) Enables workflow history tracking, storing collected history in the givenMutableWorkflowHistoryRepository.The module creates its own
WorkflowHistoryProjector, injecting the repository constructed by the givenworkflowHistoryRepository.- Parameters:
workflowHistoryRepository- aComponentBuilderconstructing theMutableWorkflowHistoryRepository- Returns:
- this phase, for further optional configuration
-
withoutHistory
WorkflowModule.OptionalPhase<C> withoutHistory()Disables workflow history tracking for this module.No historic information about workflow executions will be collected.
- Returns:
- this phase, for further optional configuration
-
historyProcessorConfiguration
WorkflowModule.OptionalPhase<C> historyProcessorConfiguration(Function<PooledStreamingEventProcessorConfiguration, PooledStreamingEventProcessorConfiguration> historyProcessorConfiguration) Applies the givenhistoryProcessorConfigurationfunction to thePooledStreamingEventProcessorConfigurationbacking the history projector's own, dedicated event processor.Note that setting these properties do not make sense if
history has been disabled.- Parameters:
historyProcessorConfiguration- a function customizing thePooledStreamingEventProcessorConfigurationof the history projector's event processor- Returns:
- this phase, for further optional configuration
-
contextFactory
WorkflowModule.OptionalPhase<C> contextFactory(ComponentBuilder<WorkflowContextFactory<C>> workflowContextFactory) Registers the givenComponentBuilderof aWorkflowContextFactoryas the context factory for the workflow module being built, overriding any factory a DSL module registered forWorkflowModule.contextType().The factory is responsible for creating the
WorkflowContextthat is passed toworkflow definitionsduring execution. Left uncalled, the module falls back to theWorkflowContextFactorya DSL's ownConfigurationEnhancerregistered forWorkflowModule.contextType()- for exampleSimpleWorkflowContextor the Kotlin DSL's context type both have one registered automatically. A customWorkflowContexttype has no such enhancer, so it still requires this method to be called, or building fails with a clear error.- Parameters:
workflowContextFactory- aComponentBuilderconstructing theWorkflowContextFactory- Returns:
- this phase, for further optional configuration
-
configurationRegistry
WorkflowModule.OptionalPhase<C> configurationRegistry(ComponentBuilder<WorkflowConfigurationRegistry<?>> workflowConfigurationRegistry) Registers the givenComponentBuilderof aWorkflowConfigurationRegistryas the registry for the workflow module being built.The registry stores workflow configurations together with their corresponding
start conditions, and is used by theWorkflowEngineto look up which workflow to start for a given event.- Parameters:
workflowConfigurationRegistry- aComponentBuilderconstructing theWorkflowConfigurationRegistry- Returns:
- this phase, for further optional configuration
-
executionRepository
WorkflowModule.OptionalPhase<C> executionRepository(ComponentBuilder<WorkflowExecutionRepository> workflowExecutionRepository) Registers the givenComponentBuilderof aWorkflowExecutionRepositoryas the repository for the workflow module being built.The repository is responsible for persisting and retrieving workflow instances, where each instance is identified by a unique workflow identifier and bundles configuration, context, and execution state.
- Parameters:
workflowExecutionRepository- aComponentBuilderconstructing theWorkflowExecutionRepository- Returns:
- this phase, for further optional configuration
-