async Task KeepPolling(PullStrategy strategy = PullStrategy.KeepPulling, int?waitTimeSeconds = 10) { var queueIsEmpty = false; do { try { queueIsEmpty = !await Poll(waitTimeSeconds); } catch (Exception exception) { Log.For <Subscriber>().Error(exception); } }while (strategy == PullStrategy.KeepPulling || !queueIsEmpty); }
async Task KeepPolling(PullStrategy strategy = PullStrategy.KeepPulling, int waitTimeSeconds = 10) { await Task.Run(() => { }); Poll(waitTimeSeconds); //var queueIsEmpty = false; //do //{ //try { queueIsEmpty = !await Poll(waitTimeSeconds); } //catch (Exception exception) { Log.For<Subscriber>().Error(exception); } //} //while (strategy == PullStrategy.KeepPulling || !queueIsEmpty); }
public Puller(string subject, string consumerGroup, bool isBroadcast, TagType tagType, string[] tags, ConsumeMode consumeMode, PullController controller, PullStrategy pullStrategy, LoadBalance loadBalance) { _subject = subject; _originSubject = RetrySubjectUtils.RealSubject(_subject); _consumerGroup = consumerGroup; _isBroadcast = isBroadcast; _consumeMode = consumeMode; _tagType = (_tags == null || _tags.Length == 0) ? (byte)0 : (byte)tagType; _tags = tags; _controller = controller; _pullStrategy = pullStrategy; _loadBalance = loadBalance; }
async Task KeepPolling(PullStrategy strategy = PullStrategy.KeepPulling) { var queueIsEmpty = false; do { try { queueIsEmpty = (await Poll() == false); } catch (Exception exception) { Log.For <Subscriber>().Error(exception); } }while (strategy == PullStrategy.KeepPulling || !queueIsEmpty); }
async Task RunHandler(PullStrategy strategy = PullStrategy.KeepPulling) { do { using (await SyncLock.Lock()) if (await HandleNext()) { continue; } if (strategy == PullStrategy.KeepPulling) { Thread.Sleep(5000); } else { break; } }while (true); }