public SelectedProblemProvider(IUserInputProvider inputProvider, ISolverProvider solverProvider, IConfigurationValueProvider provider, SolvedConfigurationProvider solvedConfigurationProvider)
 {
     _inputProvider               = inputProvider;
     _configurationProvider       = provider;
     _solvedConfigurationProvider = solvedConfigurationProvider;
     _solverProvider              = solverProvider;
 }
Ejemplo n.º 2
0
        public WorkerRole()
        {
            _pulsers = Pulsers.FromAssembly(Assembly.GetAssembly(typeof(ImportFileProcessed)))
                       .ToList();


            var container = new WindsorContainer();

            _configurationValueProvider = new AzureConfigurationValueProvider();
            SetupDi(container, _configurationValueProvider, _pulsers.ToArray());
            _pulserPublisher = container.Resolve <PulserPublisher>();
            _orchestrator    = container.Resolve <Orchestrator>();

            // insert the list here
            var keyValueStore = container.Resolve <IDynamoStore>();
            var blob          = new SimpleBlob()
            {
                Body = Assembly.GetExecutingAssembly()
                       .GetManifestResourceStream("BeeHive.Sample.FileImport.Worker.Data.SampleData.txt"),
                Id           = "FileDrop/ImportFiles/SampleData.txt",
                LastModified = DateTimeOffset.Now
            };

            keyValueStore.UpsertAsync(blob);

            // add one topic that will not be created automagically by orchestrator
            // because no actor registered against it
            var q = container.Resolve <IEventQueueOperator>();

            q.CreateQueueAsync(QueueName.FromSimpleQueueName("NewIndexUpserted")).Wait();
        }
Ejemplo n.º 3
0
        public NestBatchPusher(string esUrl, IIndexNamer indexNamer, IConfigurationValueProvider configurationValueProvider)
        {
            _indexNamer = indexNamer;
            if (!int.TryParse(configurationValueProvider.GetValue(ConfigurationKeys.BulkBatchSize), out _batchSize))
            {
                _batchSize = 500;
            }

            var endodedCreds = configurationValueProvider.GetValue(ConfigurationKeys.TabSeparatedCustomEsHttpHeaders)
                               .Replace("Authorization: Basic", "").Trim();
            var credentials = Encoding.UTF8.GetString(Convert.FromBase64String(endodedCreds)).Split(':');

            if (!bool.TryParse(configurationValueProvider.GetValue(ConfigurationKeys.EsPipelineEnabled), out _setPipeline))
            {
                _setPipeline = false;
            }

            var connectionConfiguration = new ConnectionSettings(
                new SingleNodeConnectionPool(new Uri(esUrl)))
                                          .ServerCertificateValidationCallback(delegate { return(true); })
                                          .BasicAuthentication(credentials[0], credentials[1])
                                          .RequestTimeout(TimeSpan.FromMinutes(2))
                                          //.EnableDebugMode(_ => { if(!_.Success) Console.WriteLine(); })
                                          .DefaultIndex("DafaultIndex");

            _client = new ElasticClient(connectionConfiguration);
        }
Ejemplo n.º 4
0
        public IndexNamer(IConfigurationValueProvider configurationValueProvider)
        {
            _indexPrefix = configurationValueProvider.GetValue(ConfigurationKeys.EsIndexPrefix);
            var value = configurationValueProvider.GetValue(ConfigurationKeys.EsOneIndexPerType);

            _oneIndexPerType = Convert.ToBoolean(value);
        }
 public EncryptionTokenProvider(IStringCryptoTransformer crypto,
     IConfigurationValueProvider configProvider)
 {
     this.crypto = crypto;
     this.configProvider = configProvider;
     this.volatileDataProvider = new TokenDateTimeProvider();
 }
        public UserConfigurationProvider(IUserInputProvider inputProvider, IConfigurationValueProvider provider)
        {
            _inputProvider = inputProvider;
            var fileName = provider.Get(ConfigurationConstants.UserConfigFileKey) ?? ConfigurationConstants.DefaultUserConfigFileName;

            _userConfigurationProvider = new UserConfigurationValueProvider(fileName);
        }
Ejemplo n.º 7
0
 private void MakeSureTableIsThere(IConfigurationValueProvider configurationValueProvider)
 {
     if (_table == null)
     {
         lock (_lock)
         {
             if (_table == null)
             {
                 //var account = CloudStorageAccount.Parse(configurationValueProvider.GetValue(ConfigurationKeys.StorageConnectionString));
                 CloudStorageAccount account;
                 if (!String.IsNullOrWhiteSpace(
                         configurationValueProvider.GetValue(ConfigurationKeys.StorageAccountSasKey)))
                 {
                     // Create new storage credentials using the SAS token.
                     var accountSas =
                         new StorageCredentials(
                             configurationValueProvider.GetValue(ConfigurationKeys.StorageAccountSasKey));
                     // Use these credentials and the account name to create a Blob service client.
                     account = new CloudStorageAccount(accountSas, ConfigurationKeys.StorageAccountName, "",
                                                       useHttps: true);
                 }
                 else
                 {
                     account =
                         CloudStorageAccount.Parse(
                             configurationValueProvider.GetValue(ConfigurationKeys.StorageConnectionString));
                 }
                 var client = account.CreateCloudTableClient();
                 _table = client.GetTableReference(configurationValueProvider.GetValue(ConfigurationKeys.TableName));
                 _table.CreateIfNotExists();
             }
         }
     }
 }
Ejemplo n.º 8
0
        public WorkerRole()
        {
            _pulsers = Pulsers.FromAssembly(Assembly.GetAssembly(typeof(ImportFileProcessed)))
                .ToList();


            var container = new WindsorContainer();

            _configurationValueProvider = new AzureConfigurationValueProvider();
            SetupDi(container, _configurationValueProvider, _pulsers.ToArray());
            _pulserPublisher = container.Resolve<PulserPublisher>();
            _orchestrator = container.Resolve<Orchestrator>();

            // insert the list here
            var keyValueStore = container.Resolve<IDynamoStore>();
            var blob = new SimpleBlob()
            {
                Body = Assembly.GetExecutingAssembly()
                    .GetManifestResourceStream("BeeHive.Sample.FileImport.Worker.Data.SampleData.txt"),
                Id = "FileDrop/ImportFiles/SampleData.txt",
                LastModofied = DateTimeOffset.Now
            };
            keyValueStore.UpsertAsync(blob);

            // add one topic that will not be created automagically by orchestrator
            // because no actor registered against it
            var q = container.Resolve<IEventQueueOperator>();

            q.CreateQueueAsync("NewIndexUpserted").Wait();



        }
 public EncryptionTokenProvider(IStringCryptoTransformer crypto,
     IConfigurationValueProvider configProvider,
     ITokenVolatileDataProvider volatileDataProvider)
     : this(crypto, configProvider)
 {
     ErrorTrap.AddRaisableAssertion<ArgumentNullException>(volatileDataProvider != null,
         "volatileDataProvider != null");
     this.volatileDataProvider = volatileDataProvider;
 }
Ejemplo n.º 10
0
        static void Main(string[] args)
        {
            ServicePointManager.DefaultConnectionLimit = 1000;
            ThreadPool.SetMinThreads(100, 100);

            var container      = new WindsorContainer();
            var serviceLocator = new WindsorServiceLocator(container);

            _configurationValueProvider = new AppSettingsConfigurationValueProvider();
            var storageConnectionString    = _configurationValueProvider.GetValue(ConfigurationKeys.TableStorageConnectionString);
            var servicebusConnectionString = _configurationValueProvider.GetValue(ConfigurationKeys.ServiceBusConnectionString);

            container.Register(

                Component.For <Orchestrator>()
                .ImplementedBy <Orchestrator>()
                .LifestyleSingleton(),
                Component.For <MasterScheduler>()
                .ImplementedBy <MasterScheduler>()
                .LifestyleSingleton(),
                Component.For <IConfigurationValueProvider>()
                .Instance(_configurationValueProvider),
                Component.For <IServiceLocator>()
                .Instance(serviceLocator),
                Component.For <IActorConfiguration>()
                .Instance(
                    ActorDescriptors.FromAssemblyContaining <PeckSourceScheduled>()
                    .ToConfiguration()),
                Component.For <IFactoryActor>()
                .ImplementedBy <FactoryActor>()
                .LifestyleTransient(),
                Component.For <PeckSourceProcessor>()
                .ImplementedBy <PeckSourceProcessor>()
                .LifestyleTransient(),
                Component.For <ILockStore>()
                .Instance(new AzureLockStore(new BlobSource()
            {
                ConnectionString = storageConnectionString,
                ContainerName    = "locks",
                Path             = "woodpecker/locks/master_Keys/"
            })),
                Component.For <IEventQueueOperator>()
                .Instance(new ServiceBusOperator(servicebusConnectionString))

                );

            _orchestrator = container.Resolve <Orchestrator>();
            _scheduler    = container.Resolve <MasterScheduler>();

            Task.Run(() => _orchestrator.SetupAsync()).Wait();
            _orchestrator.Start();

            Console.WriteLine("Working ...");
            Work();
            _orchestrator.Stop();
        }
 public PrefixConfigurationValueProvider(IConfigurationValueProvider underlyinConfigurationValueProvider,
                                         string prefix)
 {
     _underlyinConfigurationValueProvider = underlyinConfigurationValueProvider ?? throw new ArgumentNullException(nameof(underlyinConfigurationValueProvider));
     if (string.IsNullOrWhiteSpace(prefix))
     {
         throw new ArgumentNullException(nameof(prefix));
     }
     _prefix = prefix;
 }
Ejemplo n.º 12
0
 public MasterScheduler(IEventQueueOperator eventQueueOperator, 
     IConfigurationValueProvider configurationValueProvider,
     ISourceConfiguration sourceConfiguration,
     IElasticsearchClient elasticsearchClient,
     IServiceLocator locator)
 {
     _sourceConfiguration = sourceConfiguration;
     _locator = locator;
     _elasticsearchClient = elasticsearchClient;
     _configurationValueProvider = configurationValueProvider;
     _eventQueueOperator = eventQueueOperator;
  }
Ejemplo n.º 13
0
        public ElasticsearchBatchPusher(IHttpClient httpClient, IConfigurationValueProvider configurationValueProvider, string esUrl, int batchSize = 100)
        {
            _httpClient = httpClient;
            _batchSize  = batchSize;
            _esUrl      = esUrl;
            var esBackOffMinSecondsString = configurationValueProvider.GetValue(ConfigurationKeys.EsBackOffMinSeconds);
            var esBackOffMaxSecondsString = configurationValueProvider.GetValue(ConfigurationKeys.EsBackOffMaxSeconds);
            var esBackOffMinSeconds       = string.IsNullOrWhiteSpace(esBackOffMinSecondsString) ? 5 : int.Parse(esBackOffMinSecondsString);
            var esBackOffMaxSeconds       = string.IsNullOrWhiteSpace(esBackOffMaxSecondsString) ? 100 : int.Parse(esBackOffMaxSecondsString);

            _interval = new DoublyIncreasingInterval(TimeSpan.FromSeconds(esBackOffMinSeconds), TimeSpan.FromSeconds(esBackOffMaxSeconds), 5);
        }
Ejemplo n.º 14
0
 public MasterScheduler(IEventQueueOperator eventQueueOperator,
                        IConfigurationValueProvider configurationValueProvider,
                        ISourceConfiguration sourceConfiguration,
                        IElasticsearchClient elasticsearchClient,
                        IServiceLocator locator)
 {
     _sourceConfiguration        = sourceConfiguration;
     _locator                    = locator;
     _elasticsearchClient        = elasticsearchClient;
     _configurationValueProvider = configurationValueProvider;
     _eventQueueOperator         = eventQueueOperator;
 }
Ejemplo n.º 15
0
        public MasterScheduler(IEventQueueOperator eventQueueOperator,
                               IConfigurationValueProvider configurationValueProvider,
                               ILockStore lockStore)
        {
            _lockStore          = lockStore;
            _eventQueueOperator = eventQueueOperator;
            var tscn    = configurationValueProvider.GetValue(ConfigurationKeys.TableStorageConnectionString);
            var account = CloudStorageAccount.Parse(tscn);
            var client  = account.CreateCloudTableClient();

            _table = client.GetTableReference(configurationValueProvider.GetValue(ConfigurationKeys.SourceTableName));
            _table.CreateIfNotExistsAsync();
            _clustername = configurationValueProvider.GetValue(ConfigurationKeys.ClusterName);
        }
Ejemplo n.º 16
0
 public ShardKeyActor(IElasticsearchBatchPusher pusher,
                      ITelemetryProvider telemetryProvider,
                      IConfigurationValueProvider configurationValueProvider)
 {
     _pusher               = pusher;
     _telemetryProvider    = telemetryProvider;
     _durationInstrumentor = telemetryProvider.GetInstrumentor <ShardKeyActor>();
     if (!int.TryParse(
             configurationValueProvider.GetValue(ConfigurationKeys.ShadKeyArrivalDelayWarningInSeconds),
             out _shardKeyDelayWarning))
     {
         _shardKeyDelayWarning = 120;
     }
 }
Ejemplo n.º 17
0
        public ServiceActivator(
            Container parentContainer,
            ILogger logger,
            IServiceContainer serviceContainer,
            IConfigurationValueProvider configurationValueProvider)
        {
            _parentContainer            = parentContainer;
            _logger                     = logger;
            _serviceContainer           = serviceContainer;
            _configurationValueProvider = configurationValueProvider;

            ActivationGroups = new HashSet <string>();
            ServiceProviders = new Dictionary <Type, IServiceProvider>();
            OverrideTypes    = new HashSet <Type>();
        }
 private void MakeSureTableIsThere(IConfigurationValueProvider configurationValueProvider)
 {
     if (_table == null)
     {
         lock (_lock)
         {
             if (_table == null)
             {
                 var account = CloudStorageAccount.Parse(configurationValueProvider.GetValue(ConfigurationKeys.StorageConnectionString));
                 var client  = account.CreateCloudTableClient();
                 _table = client.GetTableReference(configurationValueProvider.GetValue(ConfigurationKeys.TableName));
                 _table.CreateIfNotExists();
             }
         }
     }
 }
 private void MakeSureTableIsThere(IConfigurationValueProvider configurationValueProvider)
 {
     if (_table == null)
     {
         lock (_lock)
         {
             if (_table == null)
             {
                 var account = CloudStorageAccount.Parse(configurationValueProvider.GetValue(ConfigurationKeys.StorageConnectionString));
                 var client = account.CreateCloudTableClient();
                 _table = client.GetTableReference(configurationValueProvider.GetValue(ConfigurationKeys.TableName));
                 _table.CreateIfNotExists();
             }
         }
     }
 }
Ejemplo n.º 20
0
 public MasterScheduler(IEventQueueOperator eventQueueOperator,
                        IConfigurationValueProvider configurationValueProvider,
                        ISourceConfiguration sourceConfiguration,
                        IElasticsearchClient elasticsearchClient,
                        IServiceLocator locator,
                        ILockStore lockStore,
                        ITelemetryProvider telemetryProvider,
                        IIndexNamer indexNamer,
                        IKeyValueStore keyValueStore)
 {
     _keyValueStore                = keyValueStore;
     _indexNamer                   = indexNamer;
     _lockStore                    = lockStore;
     _telemetryProvider            = telemetryProvider;
     _sourceConfiguration          = sourceConfiguration;
     _locator                      = locator;
     _elasticsearchClient          = elasticsearchClient;
     _configurationValueProvider   = configurationValueProvider;
     _eventQueueOperator           = eventQueueOperator;
     _scheduleDurationInstrumentor = telemetryProvider.GetInstrumentor <MasterScheduler>();
 }
Ejemplo n.º 21
0
        public WorkerRole()
        {
            _pulsers = Pulsers.FromAssembly(Assembly.GetAssembly(typeof(NewsFeedPulsed)))
                .ToList();


            var container = new WindsorContainer();

            _configurationValueProvider = new AzureConfigurationValueProvider();
            SetupDi(container, _configurationValueProvider, _pulsers.ToArray());
            _pulserPublisher = container.Resolve<PulserPublisher>();
            _orchestrator = container.Resolve<Orchestrator>();

            // insert the list here
            var keyValueStore = container.Resolve<IKeyValueStore>();
            var blob = new SimpleBlob()
            {
                Body = new MemoryStream(Encoding.UTF8.GetBytes("http://feeds.bbci.co.uk/news/rss.xml")),
                Id = "newsFeeds.txt",
                LastModofied = DateTimeOffset.Now
            };
            keyValueStore.UpsertAsync(blob);

        }
Ejemplo n.º 22
0
        public WorkerRole()
        {
            _pulsers = Pulsers.FromAssembly(Assembly.GetAssembly(typeof(NewsFeedPulsed)))
                       .ToList();


            var container = new WindsorContainer();

            _configurationValueProvider = new AzureConfigurationValueProvider();
            SetupDi(container, _configurationValueProvider, _pulsers.ToArray());
            _pulserPublisher = container.Resolve <PulserPublisher>();
            _orchestrator    = container.Resolve <Orchestrator>();

            // insert the list here
            var keyValueStore = container.Resolve <IKeyValueStore>();
            var blob          = new SimpleBlob()
            {
                Body         = new MemoryStream(Encoding.UTF8.GetBytes("http://feeds.bbci.co.uk/news/rss.xml")),
                Id           = "newsFeeds.txt",
                LastModofied = DateTimeOffset.Now
            };

            keyValueStore.UpsertAsync(blob);
        }
Ejemplo n.º 23
0
        public WorkerRole()
        {
            var container      = new WindsorContainer();
            var serviceLocator = new WindsorServiceLocator(container);

            _configurationValueProvider = new AzureConfigurationValueProvider();
            var storageConnectionString = _configurationValueProvider.GetValue(ConfigurationKeys.StorageConnectionString);
            var clusterLockContainer    = _configurationValueProvider.GetValue(ConfigurationKeys.ClusterLockContainer);
            var clusterLockRootPath     = _configurationValueProvider.GetValue(ConfigurationKeys.ClusterLockRootPath);
            var headersText             = _configurationValueProvider.GetValue(ConfigurationKeys.TabSeparatedCustomEsHttpHeaders);
            var headers = new List <KeyValuePair <string, string> >();

            if (headersText != null)
            {
                foreach (var header in headersText.Split('\t'))
                {
                    var strings = header.Split(new [] { ": " }, StringSplitOptions.RemoveEmptyEntries);
                    if (strings.Length == 2)
                    {
                        headers.Add(new KeyValuePair <string, string>(strings[0], strings[1]));
                    }
                }
            }

            int bulkBatchSize       = 100;
            var bulkBatchSizeString = _configurationValueProvider.GetValue(ConfigurationKeys.BulkBatchSize);

            int.TryParse(bulkBatchSizeString, out bulkBatchSize);

            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 <IServiceLocator>()
                .Instance(serviceLocator),
                Component.For <IActorConfiguration>()
                .Instance(
                    ActorDescriptors.FromAssemblyContaining <ShardRangeActor>()
                    .ToConfiguration().UpdateParallelism(_configurationValueProvider)),
                Component.For <ISourceConfiguration>()
                .ImplementedBy <TableStorageConfigurationSource>(),
                Component.For <IFactoryActor>()
                .ImplementedBy <FactoryActor>()
                .LifestyleTransient(),
                Component.For <ShardKeyActor>()
                .ImplementedBy <ShardKeyActor>()
                .LifestyleTransient(),
                Component.For <ShardRangeActor>()
                .ImplementedBy <ShardRangeActor>()
                .LifestyleTransient(),
                Component.For <BlobFileActor>()
                .ImplementedBy <BlobFileActor>()
                .LifestyleTransient(),
                Component.For <BlobFileConventionActor>()
                .ImplementedBy <BlobFileConventionActor>()
                .LifestyleTransient(),
                Component.For <IisBlobScheduler>()
                .ImplementedBy <IisBlobScheduler>()
                .LifestyleTransient(),
                Component.For <IisBlobConventionScheduler>()
                .ImplementedBy <IisBlobConventionScheduler>()
                .LifestyleTransient(),
                Component.For <RangeShardKeyScheduler>()
                .ImplementedBy <RangeShardKeyScheduler>()
                .LifestyleTransient(),
                Component.For <SimpleBlobScheduler>()
                .ImplementedBy <SimpleBlobScheduler>()
                .LifestyleTransient(),
                Component.For <MinuteTableShardScheduler>()
                .ImplementedBy <MinuteTableShardScheduler>()
                .LifestyleTransient(),
                Component.For <D18MinuteTableShardScheduler>()
                .ImplementedBy <D18MinuteTableShardScheduler>()
                .LifestyleTransient(),
                Component.For <Modulo10MinuteTableShardScheduler>()
                .ImplementedBy <Modulo10MinuteTableShardScheduler>()
                .LifestyleTransient(),
                Component.For <ReverseTimestampMinuteTableShardScheduler>()
                .ImplementedBy <ReverseTimestampMinuteTableShardScheduler>()
                .LifestyleTransient(),
                Component.For <IisLogParser>()
                .ImplementedBy <IisLogParser>()
                .LifestyleTransient(),
                Component.For <AkamaiLogParser>()
                .ImplementedBy <AkamaiLogParser>()
                .LifestyleTransient(),
                Component.For <IIndexNamer>()
                .ImplementedBy <IndexNamer>()
                .LifestyleSingleton(),
                Component.For <IHttpClient>()
                .ImplementedBy <DefaultHttpClient>()
                .LifestyleSingleton()
                .DependsOn(Dependency.OnValue("defaultHeaders", headers)),
                Component.For <ITempDownloadLocationProvider>()
                .ImplementedBy <AzureTempDownloadLocationProvider>()
                .LifestyleSingleton(),
                Component.For <IElasticsearchBatchPusher>()
                .ImplementedBy <ElasticsearchBatchPusher>()
                .LifestyleTransient()
                .DependsOn(Dependency.OnValue("esUrl", _configurationValueProvider.GetValue(ConfigurationKeys.ElasticSearchUrl)))
                .DependsOn(Dependency.OnValue("batchSize", bulkBatchSize)),
                Component.For <ILockStore>()
                .Instance(new AzureLockStore(new BlobSource()
            {
                ConnectionString = storageConnectionString,
                ContainerName    = clusterLockContainer,
                Path             = clusterLockRootPath
            })),
                Component.For <IKeyValueStore>()
                .Instance(new AzureKeyValueStore(storageConnectionString, clusterLockContainer)),
                Component.For <IEventQueueOperator>()
                .Instance(new ServiceBusOperator(servicebusConnectionString)),
                Component.For <ITelemetryProvider>()
                .ImplementedBy <TelemetryProvider>()
                .LifestyleSingleton()
                );

            _orchestrator  = container.Resolve <Orchestrator>();
            _scheduler     = container.Resolve <MasterScheduler>();
            _keyValueStore = container.Resolve <IKeyValueStore>();
            ServicePointHelper.ApplyStandardSettings(_configurationValueProvider.GetValue(ConfigurationKeys.ElasticSearchUrl));
        }
Ejemplo n.º 24
0
 public IisBlobScheduler(ILockStore lockStore, IConfigurationValueProvider configurationValueProvider)
     : base(configurationValueProvider)
 {
 }
 public ContentDeliveryNetworkResolver(IConfigurationValueProvider configurationValueProvider)
 {
     _configurationValueProvider = configurationValueProvider;
 }
Ejemplo n.º 26
0
 public ServerConfigurationProvider(IUserInputProvider inputProvider, IConfigurationValueProvider configurationValueProvider)
 {
     _inputProvider = inputProvider;
     _valueProvider = configurationValueProvider;
 }
 public D18MinuteTableShardScheduler(ILockStore lockStore, IConfigurationValueProvider configurationValueProvider)
     : base(lockStore, configurationValueProvider)
 {
 }
 public ReverseTimestampMinuteTableShardScheduler(ILockStore lockStore, IConfigurationValueProvider configurationValueProvider)
     : base(lockStore, configurationValueProvider)
 {
 }
 public ReverseTimestampMinuteTableShardScheduler(ILockStore lockStore, IConfigurationValueProvider configurationValueProvider)
     : base(lockStore, configurationValueProvider)
 {
 }
Ejemplo n.º 30
0
        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>();
        }
Ejemplo n.º 31
0
        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()

                );
        }
 public ReverseTimestampMinuteTableShardScheduler(IConfigurationValueProvider configurationValueProvider)
     : base(configurationValueProvider)
 {
 }
Ejemplo n.º 33
0
 public IisBlobScheduler(ILockStore lockStore, IConfigurationValueProvider configurationValueProvider)
     : base(lockStore, configurationValueProvider)
 {
 }
 public RangeShardKeyScheduler(ILockStore lockStore, IConfigurationValueProvider configurationValueProvider)
     : base(lockStore, configurationValueProvider)
 {
 }
 public D18MinuteTableShardScheduler(ILockStore lockStore, IConfigurationValueProvider configurationValueProvider)
     : base(lockStore, configurationValueProvider)
 {
 }
Ejemplo n.º 36
0
 public BaseScheduler(ILockStore lockStore, IConfigurationValueProvider configurationValueProvider)
 {
     _configurationValueProvider = configurationValueProvider;
     _lockStore = lockStore;
 }
 public TokenDateTimeVerifier(IConfigurationValueProvider configProvider)
 {
     this.configProvider = configProvider;
 }
Ejemplo n.º 38
0
 public AzureStorageManager(IConfigurationValueProvider configurationValueProvider)
 {
     _configurationValueProvider = configurationValueProvider;
 }
 public StringCryptoTransformer(IConfigurationValueProvider configProvider)
 {
     this.configProvider = configProvider;
 }
Ejemplo n.º 40
0
 public SweeperActor(IDynamoStore dynamoStore, 
     IConfigurationValueProvider configurationValueProvider)
 {
     _configurationValueProvider = configurationValueProvider;
     _dynamoStore = dynamoStore;
 }
 public MinuteTableShardScheduler(IConfigurationValueProvider configurationValueProvider)
     : base(configurationValueProvider)
 {
 }
Ejemplo n.º 42
0
 public SimpleBlobScheduler(IConfigurationValueProvider configurationValueProvider)
     : base(configurationValueProvider)
 {
 }
Ejemplo n.º 43
0
 public EmailMessenger(IConfigurationValueProvider configurationValueProvider)
 {
     _configurationValueProvider = configurationValueProvider;
 }
 public TokenDateTimeVerifier()
 {
     this.configProvider = new NameValueSectionConfigurationProvider(
         ConfigSectionsResource.DefaultTokenDateTimeVerifierSectionName);
 }
 public TableStorageConfigurationSource(IConfigurationValueProvider configurationValueProvider)
 {
     MakeSureTableIsThere(configurationValueProvider);
 }
Ejemplo n.º 46
0
        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()
                
            );


        }
Ejemplo n.º 47
0
 public RecordImporterActor(IConfigurationValueProvider configurationValueProvider)
 {
     _configurationValueProvider = configurationValueProvider;
 }
Ejemplo n.º 48
0
        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);
            var headersText = _configurationValueProvider.GetValue(ConfigurationKeys.TabSeparatedCustomEsHttpHeaders);
            var headers     = new List <KeyValuePair <string, string> >();

            if (headersText != null)
            {
                foreach (var header in headersText.Split('\t'))
                {
                    var strings = header.Split(new[] { ": " }, StringSplitOptions.RemoveEmptyEntries);
                    if (strings.Length == 2)
                    {
                        headers.Add(new KeyValuePair <string, string>(strings[0], strings[1]));
                    }
                }
            }

            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()
                .DependsOn(Dependency.OnValue("defaultHeaders", headers)),
                Component.For <ShardKeyActor>()
                .ImplementedBy <ShardKeyActor>()
                .LifestyleTransient(),
                Component.For <ShardRangeActor>()
                .ImplementedBy <ShardRangeActor>()
                .LifestyleTransient(),
                Component.For <BlobFileActor>()
                .ImplementedBy <BlobFileActor>()
                .LifestyleTransient(),
                Component.For <BlobFileConventionActor>()
                .ImplementedBy <BlobFileConventionActor>()
                .LifestyleTransient(),
                Component.For <ITempDownloadLocationProvider>()
                .ImplementedBy <TempDownloadLocationProvider>()
                .LifestyleSingleton(),
                Component.For <IisBlobScheduler>()
                .ImplementedBy <IisBlobScheduler>()
                .LifestyleTransient(),
                Component.For <IisBlobConventionScheduler>()
                .ImplementedBy <IisBlobConventionScheduler>()
                .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>();
        }
Ejemplo n.º 49
0
 public AuthenticationTokenProvider(IConfigurationValueProvider configurationValueProvider)
 {
     _configurationValueProvider = configurationValueProvider;
 }