コード例 #1
0
        /// <inheritdoc />
        public Dictionary <string, int> Handle(GetMessageErrorsQuery <int> query)
        {
            var returnData = new Dictionary <string, int>();

            using (var db = _connectionInformation.GetDatabase())
            {
                var col = db.Database.GetCollection <Schema.ErrorTrackingTable>(_tableNameHelper.ErrorTrackingName);

                var results = col.Query()
                              .Where(x => x.QueueId.Equals(query.QueueId))
                              .ToList();

                foreach (var record in results)
                {
                    returnData.Add(record.ExceptionType, record.RetryCount);
                }

                return(returnData);
            }
        }
コード例 #2
0
        /// <inheritdoc />
        public Dictionary <string, int> Handle(GetMessageErrorsQuery <T> query)
        {
            var returnData = new Dictionary <string, int>();

            using (var connection = _connectionFactory.Create())
            {
                connection.Open();
                using (var command = connection.CreateCommand())
                {
                    _prepareQuery.Handle(query, command, CommandStringTypes.GetMessageErrors);
                    using (var reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            var errorType = _readColumn.ReadAsString(CommandStringTypes.GetMessageErrors, 0, reader).Trim();
                            var count     = _readColumn.ReadAsInt32(CommandStringTypes.GetMessageErrors, 1, reader);
                            returnData.Add(errorType, count);
                        }
                    }
                }
            }

            return(returnData);
        }