예제 #1
0
        public override bool OnStart()
        {
            try
            {
                // Set up the process defaults for connections to optimize storage performance
                ServicePointManager.DefaultConnectionLimit = int.MaxValue;

                var configuration = Configuration.GetCurrentConfiguration();

                _coordinator = ColdStorageCoordinator.CreateAsync(RoleEnvironment.CurrentRoleInstance.Id, configuration).Result;

                return(base.OnStart());
            }
            catch (Exception ex)
            {
                Trace.TraceError(ex.ToString());

                throw;
            }
        }
예제 #2
0
        private static async Task RunAsync(CancellationToken token)
        {
            var configuration = Configuration.GetCurrentConfiguration();
            ColdStorageCoordinator processor = null;

            try
            {
                //TODO: using fixed names causes name collision when more than one instance is created within the processor host.
                //Consider changing to use Guid instead.
                processor = await ColdStorageCoordinator.CreateAsync("Console", configuration);

                Console.WriteLine("Running processor");

                await Task.Delay(Timeout.InfiniteTimeSpan, token);
            }
            catch (Exception) {}

            if (processor != null)
            {
                await processor.TearDownAsync();
            }
        }
예제 #3
0
        private static async Task RunAsync(CancellationToken token)
        {
            var configuration = Configuration.GetCurrentConfiguration();
            ColdStorageCoordinator processor = null;
            var instrumentationPublisher     =
                new ColdStorageInstrumentationManager(true, true).CreatePublisher("Console");

            processor =
                await ColdStorageCoordinator.CreateAsync(
                    "Console",
                    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);

            Console.WriteLine("Running processor");

            try
            {
                await Task.Delay(Timeout.InfiniteTimeSpan, token);
            }
            catch (TaskCanceledException) { /* expected cancellation */ }

            processor.Dispose();
        }