Пример #1
0
        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));
        }
Пример #2
0
        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));
        }
Пример #3
0
        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);
                }
            }
        }
Пример #5
0
 public MessageQueue() : this(AzureAccount.DefaultAccount())
 {
 }
Пример #6
0
        public DenunciaPreciosSaver()
        {
            var tableClient = AzureAccount.DefaultAccount().CreateCloudTableClient();

            _tablePersister = new TablePersister <DenunciaPreciosData>(tableClient);
        }
Пример #7
0
        public ApiAccessLogSaver()
        {
            var tableClient = AzureAccount.DefaultAccount().CreateCloudTableClient();

            _tablePersister = new TablePersister <ApiAccessLogData>(tableClient);
        }