Ejemplo n.º 1
0
        static async Task Main(string[] args)
        {
            config = new ConfigurationBuilder()
                     .AddJsonFile("settings.json", true, true)
                     .AddJsonFile("local.settings.json", true, true)
                     .Build();
            AppConstants.MqttHost  = config["mqtt-host"];
            AppConstants.MqttUser  = config["mqtt-user"];
            AppConstants.MqttPass  = config["mqtt-pass"];
            AppConstants.MqttTopic = config["mqtt-topic"];
            if (mqttService == null)
            {
                mqttService = new MqttService();
            }
            mqttService.SubscribeTopic(new string[] { AppConstants.MqttTopic });
            mqttService.OnMessageReceived += MqttService_OnMessageReceived;
            //storageClient = new StorageClient(config);
            //storageClient.InitialiseConnection();
            if (parser == null)
            {
                parser = new Parser();
            }
            redis = new RedisDB(config["RedisCon"], 7);


            Task task1 = new Task(StartAISReceiver);

            task1.Start();

            Console.WriteLine("receiver is running, press any key to stop.");
            Console.ReadLine();
            task1.Dispose();
        }