/// <summary> /// Asynchronously deletes a queue and all messages. /// </summary> public async Task <int> DeleteQueueAsync(DeleteQueueOptions options) { Validate(options); var committed = false; var key = $"{_options.Namespace}:{options.QueueName}"; try { var transaction = RedisClient.CreateTransaction(); var tasks = new List <Task> { transaction.HashDeleteAsync($"{key}:Q", key), transaction.SetRemoveAsync($"{this._options.Namespace}:QUEUES", options.QueueName) }; committed = await transaction.ExecuteAsync(); if (committed) { Task.WaitAll(tasks.ToArray()); } } catch (Exception e) { Console.Error.WriteLine(e); committed = false; } return(committed ? 1 : 0); }
/// <summary> /// Synchronously deletes a queue and all messages. /// </summary> public int DeleteQueue(DeleteQueueOptions options) { return(DeleteQueueAsync(options).ConfigureAwait(false).GetAwaiter().GetResult()); }