public ActionResult ByVersion(DateTime?date) { var dateTime = date.HasValue ? date.Value : DateTime.UtcNow; var query = new LocationAccessLogQuery(AzureAccount.DefaultAccount()); var results = query.GetResultsFromDate(dateTime); IEnumerable <ApiAccessLogData> model = results.Where(data => data.PathAndQuery.Contains("lat=") && data.PathAndQuery.Contains("lon=")); var result = new Dictionary <string, int>(); foreach (var apiAccessLogData in model) { var key = HttpUtility.ParseQueryString(apiAccessLogData.PathAndQuery).Get("versionId"); if (string.IsNullOrWhiteSpace(key)) { key = "NO"; } if (result.ContainsKey(key)) { result[key]++; } else { result.Add(key, 1); } } return(View(result)); }
public ActionResult Summary(DateTime?date) { var dateTime = date.HasValue ? date.Value : DateTime.UtcNow; var query = new SummaryAccessLogQuery(AzureAccount.DefaultAccount()); var groups = query.GetResultsFromDate(dateTime); var model = groups.ToDictionary(@group => @group.Key, @group => @group.Count()); return(View(model)); }
public ActionResult Detail(DateTime?date) { var dateTime = date.HasValue ? date.Value : DateTime.UtcNow; var query = new LocationAccessLogQuery(AzureAccount.DefaultAccount()); var results = query.GetResultsFromDate(dateTime); IEnumerable <ApiAccessLogData> model = results.Where(data => data.PathAndQuery.Contains("lat=") && data.PathAndQuery.Contains("lon=")); return(View(model)); }
public void PollQueue() { // TODO: Si hay error encolar mensajes a otra queue (vale la pena?) var consumerName = GetType().Name; CloudStorageAccount account = AzureAccount.DefaultAccount(); var queue = new MessageQueue <TMessage>(account); var frequencer = GetPoollingFrequencer(); while (true) { try { var messages = queue.Dequeue(messagesBlockSize, estimatedTimeToProcessMessageBlock).ToList(); if (messages.Count > 0) { try { ProcessMessagesGroup(queue, messages); } catch (Exception e) { string message = string.Format("{0}: {1}\nStackTrace:{2}", consumerName, e.Message, e.StackTrace); Trace.WriteLine(message, "Error"); } finally { frequencer.Decrease(); } } else { Thread.Sleep(frequencer.Current); } } catch (Exception e) { string message = string.Format("Queue connection of {0}: {1}\nStackTrace:{2}", consumerName, e.Message, e.StackTrace); Trace.WriteLine(message, "Error"); Thread.Sleep(5 * 1000); } } }
public MessageQueue() : this(AzureAccount.DefaultAccount()) { }
public DenunciaPreciosSaver() { var tableClient = AzureAccount.DefaultAccount().CreateCloudTableClient(); _tablePersister = new TablePersister <DenunciaPreciosData>(tableClient); }
public ApiAccessLogSaver() { var tableClient = AzureAccount.DefaultAccount().CreateCloudTableClient(); _tablePersister = new TablePersister <ApiAccessLogData>(tableClient); }