Example #1
0
        public async Task Process(string route)
        {
            try
            {
                var max  = 3;
                var ques = await _eventQueueService.SearchEventQueues(routeName : route, onlyNoOut : true, maxRetry : max,
                                                                      pageIndex : 0, pageSize : 300);

                if (!ques.Any())
                {
                    return;
                }

                foreach (var item in ques)
                {
                    try {
                        item.OutTime = DateTime.Now;
                    }
                    catch (Exception exc) {
                        item.Note = exc.ToString();
                    }
                    finally {
                        item.Retry = item.Retry + 1;
                    }
                }

                await _eventQueueService.UpdateRangeEventQueue(ques);

                await _capBus.PublishAsync("/batch" + route, ques.ToList());
            }
            catch (Exception ex) {
                _logger.LogError(ex, $"EventQueueJob {route} Error.");
            }
        }