public KernelConfigurator(IKernel kernel) { _kernel = kernel; var namedScopeModule = new NamedScopeModule(); if (!kernel.HasModule(namedScopeModule.Name)) { kernel.Load(namedScopeModule); } _consumerRegistry = kernel.TryGet <IConsumerRegistry>(); if (_consumerRegistry == null) { kernel.Bind <IConsumerRegistry>().To <ConsumerRegistry>().InSingletonScope(); _consumerRegistry = kernel.Get <IConsumerRegistry>(); } _sagaRegistry = kernel.TryGet <ISagaRegistry>(); if (_sagaRegistry == null) { kernel.Bind <ISagaRegistry>().To <SagaRegistry>().InSingletonScope(); _sagaRegistry = kernel.Get <ISagaRegistry>(); } }
public SagaConfigurationLoaderTests() { sagaConfigurators = new[] { Substitute.For <ISagaConfigurator>(), Substitute.For <ISagaConfigurator>() }; sagaRegistry = Substitute.For <ISagaRegistry>(); sut = new SagaConfigurationLoader(sagaConfigurators, sagaRegistry); }
public KeySagaLocatorTests() { sagaRegistry = Substitute.For <ISagaRegistry>(); sagaMetadataRepository = Substitute.For <ISagaMetadataRepository>(); sut = new KeySagaLocator(sagaRegistry, sagaMetadataRepository); }
public void ConfigureSagas(ISagaRegistry sagaRegistry) { foreach (var sagaConfigInfo in sagaConventionConfigurationCache.ConfigurationInfos) { foreach (var typeToEventInfos in sagaConfigInfo.Value.Events) { foreach (var eventInfo in typeToEventInfos.Value) { if (eventInfo.IsAlwaysStarting) { sagaRegistry.Add(SagaEventRegistration.AlwaysStarting(sagaConfigInfo.Key, typeToEventInfos.Key)); } else if (eventInfo.SagaKey != null) { sagaRegistry.Add(SagaEventRegistration.MatchedByKey(sagaConfigInfo.Key, typeToEventInfos.Key, eventInfo.EventKeyExpression, eventInfo.SagaKey, eventInfo.IsStartingIfSagaNotFound)); } else { sagaRegistry.Add(SagaEventRegistration.ToAllExistingInstances(sagaConfigInfo.Key, typeToEventInfos.Key, eventInfo.IsStartingIfSagaNotFound)); } } } } }
public void LoadToRegistry(ISagaRegistry sagaRegistry) { foreach (var sagaType in sagaTypes) { foreach (var eventRegistration in sagaType.Value.EventRegistrations) { sagaRegistry.Add(eventRegistration); } } }
public SagaEngine(ISagaRegistry sagaRegistry) { _sagaRegistry = sagaRegistry; }
public KeySagaLocator(ISagaRegistry sagaRegistry, ISagaMetadataRepository sagaMetadataRepository) { this.sagaRegistry = sagaRegistry; this.sagaMetadataRepository = sagaMetadataRepository; }
public SagaConfigurationLoader(ISagaConfigurator[] sagaConfigurators, ISagaRegistry sagaRegistry) { this.sagaConfigurators = sagaConfigurators; this.sagaRegistry = sagaRegistry; }