Exemplo n.º 1
0
        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            _logger.LogDebug($"Test Background Task Start");
            stoppingToken.Register(() =>
                                   _logger.LogDebug($"Test Background Task Stop")
                                   );

            //var sss = _context.Add(new Product());

            HttpService httpService = new HttpService();

            var dic = new Dictionary <string, string>();

            dic.Add("dataNum", "10");
            dic.Add("lotteryCode", "1407");
            var resp = await httpService.PostForm("http://3dfe47bd7f4c8d70.dafacloudapp.com/v1/lottery/openResult?lotteryCode=1407&dataNum=10&", dic);

            var eventMessage = new UserErrorMessageIntegrationEvent("AKPay", "103", "h5", "簽名錯誤", DateTime.Now);

            _eventBus.Publish(eventMessage);

            while (!stoppingToken.IsCancellationRequested)
            {
                _logger.LogDebug("Test Task Doing Background Work");

                await Task.Delay(100, stoppingToken);
            }

            throw new NotImplementedException();
        }
Exemplo n.º 2
0
        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            _logger.LogDebug($"Test Background Task Start");
            stoppingToken.Register(() =>
                                   _logger.LogDebug($"Test Background Task Stop")
                                   );

            var eventMessage = new UserErrorMessageIntegrationEvent("AKPay", "103", "h5", "簽名錯誤", DateTime.Now);

            _eventBus.Publish(eventMessage);

            while (!stoppingToken.IsCancellationRequested)
            {
                _logger.LogDebug("Test Task Doing Background Work");

                await Task.Delay(100, stoppingToken);
            }

            throw new NotImplementedException();
        }