public void Configure(IReceiveEndpointConfigurator configurator, IConfigurationServiceProvider configurationServiceProvider) { ISagaStateMachineFactory stateMachineFactory = configurationServiceProvider.GetRequiredService <ISagaStateMachineFactory>(); SagaStateMachine <TInstance> stateMachine = stateMachineFactory.CreateStateMachine <TInstance>(); var repositoryFactory = configurationServiceProvider.GetRequiredService <ISagaRepositoryFactory>(); ISagaRepository <TInstance> repository = repositoryFactory.CreateSagaRepository <TInstance>(); var stateMachineConfigurator = new StateMachineSagaConfigurator <TInstance>(stateMachine, repository, configurator); LogContext.Debug?.Log("Configuring endpoint {Endpoint}, Saga: {SagaType}, State Machine: {StateMachineType}", configurator.InputAddress.GetLastPart(), TypeMetadataCache <TInstance> .ShortName, TypeMetadataCache.GetShortName(stateMachine.GetType())); GetSagaDefinition(configurationServiceProvider) .Configure(configurator, stateMachineConfigurator); foreach (Action <ISagaConfigurator <TInstance> > action in _configureActions) { action(stateMachineConfigurator); } configurator.AddEndpointSpecification(stateMachineConfigurator); }
public void StateMachineSagaConfigured <TInstance>(ISagaConfigurator <TInstance> configurator, SagaStateMachine <TInstance> stateMachine) where TInstance : class, ISaga, SagaStateMachineInstance { _stateMachineTypes.Add(stateMachine.GetType()); }