public void Create_Default() { var test = new GetErrorRetryCountQuery("test", 100); Assert.Equal("test", test.ExceptionType); Assert.Equal(100, test.QueueId); }
/// <inheritdoc /> public int Handle(GetErrorRetryCountQuery <T> query) { using (var connection = _connectionFactory.Create()) { connection.Open(); using (var command = connection.CreateCommand()) { _prepareQuery.Handle(query, command, CommandStringTypes.GetErrorRetryCount); using (var reader = command.ExecuteReader()) { if (reader.Read()) { return(_readColumn.ReadAsInt32(CommandStringTypes.GetErrorRetryCount, 0, reader)); } } } } return(0); }
/// <inheritdoc /> public void Handle(GetErrorRetryCountQuery <T> query, IDbCommand dbCommand, CommandStringTypes commandType) { dbCommand.CommandText = _commandCache.GetCommand(commandType); var queueid = dbCommand.CreateParameter(); queueid.ParameterName = "@QueueID"; queueid.DbType = DbType.Int64; //WARN should match T queueid.Value = query.QueueId; dbCommand.Parameters.Add(queueid); var exceptionType = dbCommand.CreateParameter(); exceptionType.ParameterName = "@ExceptionType"; exceptionType.DbType = DbType.AnsiString; exceptionType.Size = 500; exceptionType.Value = query.ExceptionType; dbCommand.Parameters.Add(exceptionType); }
/// <inheritdoc /> public int Handle(GetErrorRetryCountQuery <int> query) { 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)) .Where(x => x.ExceptionType == query.ExceptionType) .Limit(1) .ToList(); if (results != null && results.Count == 1) { var record = results[0]; return(record.RetryCount); } } return(0); }
public void Create_Default() { var test = new GetErrorRetryCountQuery("test", 100); Assert.Equal("test", test.ExceptionType); Assert.Equal(100, test.QueueId); }