Esempio n. 1
0
        public static IEnumerable <WindowsAzureTableEventEntry> PollForEvents(string connectionString, string tableName, int eventsToRecieve, TimeSpan waitFor)
        {
            IEnumerable <WindowsAzureTableEventEntry> entries = new WindowsAzureTableEventEntry[0];
            var timeoutToWaitUntilEventIsReceived             = DateTime.UtcNow.Add(waitFor);
            var table = GetTable(connectionString, tableName);
            var query = new TableQuery <WindowsAzureTableEventEntry>();

            while (DateTime.UtcNow < timeoutToWaitUntilEventIsReceived)
            {
                try
                {
                    entries = table.ExecuteQuery <WindowsAzureTableEventEntry>(query);
                    if (entries.Count() >= eventsToRecieve)
                    {
                        break;
                    }
                }
                catch
                { }

                Task.Delay(200).Wait();
            }

            return(entries);
        }
        public static IEnumerable<WindowsAzureTableEventEntry> PollForEvents(string connectionString, string tableName, int eventsToRecieve, TimeSpan waitFor)
        {
            IEnumerable<WindowsAzureTableEventEntry> entries = new WindowsAzureTableEventEntry[0];
            var timeoutToWaitUntilEventIsReceived = DateTime.UtcNow.Add(waitFor);
            var table = GetTable(connectionString, tableName);
            var query = new TableQuery<WindowsAzureTableEventEntry>();
            while (DateTime.UtcNow < timeoutToWaitUntilEventIsReceived)
            {
                try
                {
                    entries = table.ExecuteQuery<WindowsAzureTableEventEntry>(query);
                    if (entries.Count() >= eventsToRecieve)
                    {
                        break;
                    }
                }
                catch
                { }

                Task.Delay(200).Wait();
            }

            return entries;
        }