public static void SetupDi(IWindsorContainer container, IConfigurationValueProvider configurationValueProvider, IPulser[] pulsers) { var serviceLocator = new WindsorServiceLocator(container); container.Register( Component.For<Orchestrator>() .ImplementedBy<Orchestrator>() .LifestyleTransient(), Component.For<IActorConfiguration>() .Instance( ActorDescriptors.FromAssemblyContaining<NewsItemCaptured>() .ToConfiguration()), Component.For<IServiceLocator>() .Instance(serviceLocator), Component.For<IPulser[]>() .Instance(pulsers), Component.For<PulserPublisher>() .ImplementedBy<PulserPublisher>() .LifestyleSingleton(), Component.For<IFactoryActor>() .ImplementedBy<FactoryActor>() .LifestyleTransient(), Component.For<IEventQueueOperator>() .ImplementedBy<ServiceBusOperator>() .DynamicParameters((k, dic) => { dic["connectionString"] = configurationValueProvider.GetValue( "BusConnectionString"); }) .LifestyleSingleton(), Component.For(typeof(ICollectionStore<>)) .ImplementedBy(typeof(AzureCollectionStore<>)) .DynamicParameters((k, dic) => { dic["connectionString"] = configurationValueProvider.GetValue("StorageConnectionString"); }) .LifestyleSingleton(), Component.For(typeof(IKeyValueStore)) .ImplementedBy(typeof(AzureKeyValueStore)) .DynamicParameters((k, dic) => { dic["connectionString"] = configurationValueProvider.GetValue("StorageConnectionString"); dic["bucketName"] = "feeds"; }) .LifestyleSingleton(), Classes.FromAssemblyContaining<NewsFeedPulsed>() .Pick() ); }
protected static void Setup() { var container = new WindsorContainer(); var serviceLocator = new WindsorServiceLocator(container); _configurationValueProvider = new AppSettingsConfigProvider(); var storageConnectionString = _configurationValueProvider.GetValue(ConfigurationKeys.StorageConnectionString); var servicebusConnectionString = _configurationValueProvider.GetValue(ConfigurationKeys.ServiceBusConnectionString); container.Register( Component.For<IElasticsearchClient>() .ImplementedBy<ElasticsearchClient>() .LifestyleSingleton(), Component.For<Orchestrator>() .ImplementedBy<Orchestrator>() .LifestyleSingleton(), Component.For<MasterScheduler>() .ImplementedBy<MasterScheduler>() .LifestyleSingleton(), Component.For<IConfigurationValueProvider>() .Instance(_configurationValueProvider), Component.For<ISourceConfiguration>() .ImplementedBy<TableStorageConfigurationSource>(), Component.For<IServiceLocator>() .Instance(serviceLocator), Component.For<IActorConfiguration>() .Instance( ActorDescriptors.FromAssemblyContaining<ShardRangeActor>() .ToConfiguration()), Component.For<IFactoryActor>() .ImplementedBy<FactoryActor>() .LifestyleTransient(), Component.For<IHttpClient>() .ImplementedBy<DefaultHttpClient>() .LifestyleSingleton(), Component.For<ShardKeyActor>() .ImplementedBy<ShardKeyActor>() .LifestyleTransient(), Component.For<ShardRangeActor>() .ImplementedBy<ShardRangeActor>() .LifestyleTransient(), Component.For<BlobFileActor>() .ImplementedBy<BlobFileActor>() .LifestyleTransient(), Component.For<IisBlobScheduler>() .ImplementedBy<IisBlobScheduler>() .LifestyleTransient(), Component.For<RangeShardKeyScheduler>() .ImplementedBy<RangeShardKeyScheduler>() .LifestyleTransient(), Component.For<MinuteTableShardScheduler>() .ImplementedBy<MinuteTableShardScheduler>() .LifestyleTransient(), Component.For<ReverseTimestampMinuteTableShardScheduler>() .ImplementedBy<ReverseTimestampMinuteTableShardScheduler>() .LifestyleTransient(), Component.For<IisLogParser>() .ImplementedBy<IisLogParser>() .LifestyleTransient(), Component.For<IElasticsearchBatchPusher>() .ImplementedBy<ElasticsearchBatchPusher>() .LifestyleTransient() .DependsOn(Dependency.OnValue("esUrl", _configurationValueProvider.GetValue(ConfigurationKeys.ElasticSearchUrl))), Component.For<ILockStore>() .Instance(new AzureLockStore(new BlobSource() { ConnectionString = storageConnectionString, ContainerName = "locks", Path = "conveyor_belt/locks/master_Keys/" })), Component.For<IEventQueueOperator>() .Instance(new ServiceBusOperator(servicebusConnectionString)) ); _orchestrator = container.Resolve<Orchestrator>(); _scheduler = container.Resolve<MasterScheduler>(); }
public void ConfigureDI(IWindsorContainer container) { var serviceLocator = new WindsorServiceLocator(container); container.Register( Component.For<Orchestrator>() .ImplementedBy<Orchestrator>() .LifestyleTransient(), Component.For<IActorConfiguration>() .Instance( ActorDescriptors.FromAssemblyContaining<OrderAccepted>() .ToConfiguration()), Component.For<IServiceLocator>() .Instance(serviceLocator), Component.For<IFactoryActor>() .ImplementedBy<FactoryActor>() .LifestyleTransient(), Component.For<IEventQueueOperator>() .ImplementedBy<ServiceBusOperator>() .DynamicParameters((k, dic) => { dic["connectionString"] = _configurationValueProvider.GetValue("BusConnectionString"); }) .LifestyleSingleton(), Component.For(typeof(ICollectionStore<>)) .ImplementedBy(typeof(AzureCollectionStore<>)) .DynamicParameters((k, dic) => { dic["connectionString"] = _configurationValueProvider.GetValue("StorageConnectionString"); }) .LifestyleSingleton(), Component.For(typeof(ICounterStore)) .ImplementedBy(typeof(AzureCounterStore)) .DynamicParameters((k, dic) => { dic["source"] = new BlobSource() { ConnectionString = _configurationValueProvider.GetValue("StorageConnectionString"), ContainerName = "locks", Path = "helloLocks/" }; }) .LifestyleSingleton(), Component.For(typeof(IKeyedListStore<>)) .ImplementedBy(typeof(AzureKeyedListStore<>)) .DynamicParameters((k, dic) => { dic["connectionString"] = _configurationValueProvider.GetValue("StorageConnectionString"); }) .LifestyleSingleton(), Classes.FromAssemblyContaining<Order>() .Pick() ); }
public static void ConfigureDI(IWindsorContainer container) { var serviceLocator = new WindsorServiceLocator(container); container.Register( Component.For<Orchestrator>() .ImplementedBy<Orchestrator>() .LifestyleTransient(), Component.For<IActorConfiguration>() .Instance( ActorDescriptors.FromAssemblyContaining<OrderAccepted>() .ToConfiguration()), Component.For<IServiceLocator>() .Instance(serviceLocator), Component.For<IFactoryActor>() .ImplementedBy<FactoryActor>() .LifestyleTransient(), Component.For<IEventQueueOperator>() .ImplementedBy<InMemoryServiceBus>() .LifestyleSingleton(), Component.For(typeof(ICollectionStore<>)) .ImplementedBy(typeof(InMemoryCollectionStore<>)) .LifestyleSingleton(), Component.For(typeof(ICounterStore)) .ImplementedBy(typeof(InMemoryCounterStore)) .LifestyleSingleton(), Component.For(typeof(IKeyedListStore<>)) .ImplementedBy(typeof(InMemoryKeyedListStore<>)) .LifestyleSingleton(), Component.For<DummyActor>() .ImplementedBy<DummyActor>() .LifestyleTransient(), Classes.FromAssemblyContaining<Order>() .Pick() ); }