Esempio n. 1
0
        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);
        }
Esempio n. 3
0
        public KeySagaLocatorTests()
        {
            sagaRegistry           = Substitute.For <ISagaRegistry>();
            sagaMetadataRepository = Substitute.For <ISagaMetadataRepository>();

            sut = new KeySagaLocator(sagaRegistry, sagaMetadataRepository);
        }
Esempio n. 4
0
 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));
                 }
             }
         }
     }
 }
Esempio n. 5
0
 public void LoadToRegistry(ISagaRegistry sagaRegistry)
 {
     foreach (var sagaType in sagaTypes)
     {
         foreach (var eventRegistration in sagaType.Value.EventRegistrations)
         {
             sagaRegistry.Add(eventRegistration);
         }
     }
 }
Esempio n. 6
0
 public SagaEngine(ISagaRegistry sagaRegistry)
 {
     _sagaRegistry = sagaRegistry;
 }
Esempio n. 7
0
 public KeySagaLocator(ISagaRegistry sagaRegistry, ISagaMetadataRepository sagaMetadataRepository)
 {
     this.sagaRegistry           = sagaRegistry;
     this.sagaMetadataRepository = sagaMetadataRepository;
 }
Esempio n. 8
0
 public SagaConfigurationLoader(ISagaConfigurator[] sagaConfigurators,
                                ISagaRegistry sagaRegistry)
 {
     this.sagaConfigurators = sagaConfigurators;
     this.sagaRegistry      = sagaRegistry;
 }