<commit_before>﻿// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Collections.Generic;
using System.Diagnostics.Tracing;
using System.Runtime.ExceptionServices;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Practices.EnterpriseLibrary.SemanticLogging;
using Microsoft.Practices.IoTJourney.ColdStorage.Logging;
using Microsoft.ServiceBus;
using Microsoft.WindowsAzure.Storage;

namespace Microsoft.Practices.IoTJourney.ColdStorage.ConsoleHost
{
    internal class Program
    {

        private static void Main(string[] args)
        {
            var observableEventListener = new ObservableEventListener();

            observableEventListener.EnableEvents(
              ColdStorageEventSource.Log, EventLevel.Informational);

            observableEventListener.LogToConsole();

            Tests.Common.ConsoleHost.RunWithOptionsAsync(new Dictionary<string, Func<CancellationToken, Task>>
            {
                { "Provision Resources", ProvisionResourcesAsync },
                { "Run Cold Storage Consumer", RunAsync }
            });
        }

        private static async Task ProvisionResourcesAsync(CancellationToken token)
        {
            var configuration = Configuration.GetCurrentConfiguration();

            var nsm = NamespaceManager.CreateFromConnectionString(configuration.EventHubConnectionString);<commit_msg>Use AsyncPump in cold storage host<commit_after>﻿// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Collections.Generic;
using System.Diagnostics.Tracing;
using System.Runtime.ExceptionServices;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Practices.EnterpriseLibrary.SemanticLogging;
using Microsoft.Practices.IoTJourney.ColdStorage.Logging;
using Microsoft.ServiceBus;
using Microsoft.WindowsAzure.Storage;

namespace Microsoft.Practices.IoTJourney.ColdStorage.ConsoleHost
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            AsyncPump.Run(() => MainAsync(args));
        }

        private static async Task MainAsync(string[] args)
        {
            var observableEventListener = new ObservableEventListener();

            observableEventListener.EnableEvents(
              ColdStorageEventSource.Log, EventLevel.Informational);

            observableEventListener.LogToConsole();

            await Tests.Common.ConsoleHost.RunWithOptionsAsync(new Dictionary<string, Func<CancellationToken, Task>>
            {
                { "Provision Resources", ProvisionResourcesAsync },
                { "Run Cold Storage Consumer", RunAsync }
            });
        }

        private static async Task ProvisionResourcesAsync(CancellationToken token)
        {
            var configuration = Configuration.GetCurrentConfiguration();

            var nsm = NamespaceManager.CreateFromConnectionString(configuration.EventHubConnectionString);
{'fraction_non_alphanumeric': 0.07419150285351934, 'fraction_numerical': 0.0, 'mean_word_length': 3.3160054719562244, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5391342', 'n_tokens_mistral': 744, 'n_tokens_neox': 734, 'n_words': 183}