示例#1
0
 public Simulator(SimulatorConfiguration configuration, TelemetryClient telemetryClient)
 {
     _configuration   = configuration;
     _telemetryClient = telemetryClient;
     _producerClient  =
         new EventHubProducerClient(_configuration.EventHubConnectionString);
 }
示例#2
0
        static public async Task Main(string[] args)
        {
            var configuration            = new SimulatorConfiguration();
            var telemetryClient          = InitAppInsights(configuration.AppInsightsKey);
            var simulator                = new Simulator(configuration, telemetryClient);
            var _cancellationTokenSource = new CancellationTokenSource();
            var task = simulator.RunAsync(_cancellationTokenSource.Token);

            AppDomain.CurrentDomain.ProcessExit += (object?sender, EventArgs e) =>
            {
                _cancellationTokenSource.Cancel();
            };

            await task;
        }