private IValidatorResult GetQueueResult(Models.HareDuSettings settings, RabbitQueue queue) { log.Debug("RabbitMQValidator: GetQueueResult for {QueueName} ", queue.Name); var tags = new List <string>() { queue.Name }; string resultIdentifier = string.Format("{0}:{1}", queue.Name, queue.MessagesReady); var messageCount = string.IsNullOrEmpty(queue.Messages) ? "0" : queue.Messages; var description = string.Format("Server: {0}{4} vHost: {1}{5} {2} Messages found in error queue {3}", settings.RabbitUrl, settings.Vhost, messageCount, queue.Name, Environment.NewLine, Environment.NewLine); ValidatorResultCode code = ValidatorResultCode.Success; if (queue.Messages != null && queue.MessagesReady > 0) { code = ValidatorResultCode.Error; } log.Debug("RabbitMQValidator GetQueueResult for {QueueName} has messages {Message} and message ready count {MessagesReady}", queue.Name, queue.Messages, queue.MessagesReady); return(new ValidatorResult(this.ValidatorProxyId, description, code, queue.Name, tags)); }
public ValidatorResult(string validatorId, string description, ValidatorResultCode resultCode, string resultIdentifier, List <string> tags = null) { this.ValidatorId = Guard.NotNullOrEmpty(validatorId, "validatorId", log); this.Description = description; this.ResultCode = resultCode; this.ResultIdentifier = resultIdentifier; this.FilterSequence = tags ?? new List <string>(); }
private IValidatorResult CheckRelativityDbValueNotUpdated(IValidatorContext validatorContext, string dbCheckDescription, Func <bool> valueDoesNotExistInDb) { ValidatorResultCode code = ValidatorResultCode.Success; string description = string.Format("{0} was updated", dbCheckDescription); try { if (valueDoesNotExistInDb()) { code = ValidatorResultCode.Error; description = string.Format("{0} was not updated", dbCheckDescription); } } catch (Exception ex) { log.Error(ex, string.Format("{0}{1}", "BillingValidator: ", ex.Message)); code = ValidatorResultCode.Error; description = string.Format("{0} was not updated", dbCheckDescription); } return(new ValidatorResult(this.ValidatorProxyId, description, code, dbCheckDescription)); }