private static void Poll(object obj, DoWorkEventArgs dwea) { while (_isRunning) { //Get messages from the queue var result = QueueClient.Dequeue(); //If count > 0 if (result.Result.Any()) { //Fire event to subscribers OnDequeue(result.Result); } //Sleep Thread.Sleep(Timeout); } }