Esempio n. 1
0
        public override bool OnStart()
        {
            try
            {
                // Set the maximum number of concurrent connections
                ServicePointManager.DefaultConnectionLimit = int.MaxValue;

                // Pull the configuration object from service and app configuration
                _configuration = Configuration.GetCurrentConfiguration();

                // Create the instrumentation (performance counter publisher)
                var instrumentationPublisher =
                    new ColdStorageInstrumentationManager(
                        instrumentationEnabled: true,
                        installInstrumentation: false)
                        .CreatePublisher("WaWorkerHost");

                // Activate the cold storage processor
                _coordinator = ColdStorageCoordinator.CreateAsync(
                    RoleEnvironment.CurrentRoleInstance.Id,
                    _configuration.EventHubName,
                    _configuration.ConsumerGroupName,
                    _configuration.EventHubConnectionString,
                    _configuration.CheckpointStorageAccount,
                    _configuration.MaxBatchSize,
                    _configuration.PreFetchCount,
                    _configuration.ReceiveTimeout,
                    new[] { _configuration.BlobWriterStorageAccount },
                    _configuration.ContainerName,
                    _configuration.RollSizeForBlobWriterMb,
                    _configuration.BlobPrefix,
                    _configuration.CircuitBreakerWarningLevel,
                    _configuration.CircuitBreakerTripLevel,
                    _configuration.CircuitBreakerStallInterval,
                    _configuration.CircuitBreakerLogCooldownInterval,
                    instrumentationPublisher
                    ).Result;

                bool result = base.OnStart();

                Trace.TraceInformation("Processor has been started");

                return result;
            }
            catch (Exception ex)
            {
                LogHelpers.HandleRoleException(Logger, "Run()", ex);
                throw;
            }
        }
Esempio n. 2
0
        public override bool OnStart()
        {
            try
            {
                // Set the maximum number of concurrent connections
                ServicePointManager.DefaultConnectionLimit = int.MaxValue;

                // Pull the configuration object from service and app configuration
                _configuration = Configuration.GetCurrentConfiguration();

                // Create the instrumentation (performance counter publisher)
                var instrumentationPublisher =
                    new ColdStorageInstrumentationManager(
                        instrumentationEnabled: true,
                        installInstrumentation: false)
                    .CreatePublisher("WaWorkerHost");

                // Activate the cold storage processor
                _coordinator = ColdStorageCoordinator.CreateAsync(
                    RoleEnvironment.CurrentRoleInstance.Id,
                    _configuration.EventHubName,
                    _configuration.ConsumerGroupName,
                    _configuration.EventHubConnectionString,
                    _configuration.CheckpointStorageAccount,
                    _configuration.MaxBatchSize,
                    _configuration.PreFetchCount,
                    _configuration.ReceiveTimeout,
                    new[] { _configuration.BlobWriterStorageAccount },
                    _configuration.ContainerName,
                    _configuration.RollSizeForBlobWriterMb,
                    _configuration.BlobPrefix,
                    _configuration.CircuitBreakerWarningLevel,
                    _configuration.CircuitBreakerTripLevel,
                    _configuration.CircuitBreakerStallInterval,
                    _configuration.CircuitBreakerLogCooldownInterval,
                    instrumentationPublisher
                    ).Result;

                bool result = base.OnStart();

                Trace.TraceInformation("Processor has been started");

                return(result);
            }
            catch (Exception ex)
            {
                LogHelpers.HandleRoleException(Logger, "Run()", ex);
                throw;
            }
        }