Exemple #1
0
        public override async Task <DeleteQueueByNameResponse> DeleteQueueByName(DeleteQueueByNameRequest request, ServerCallContext context)
        {
            var queueInfo = await this.internalApi.GetQueueInfoByName(request.QueueName);

            if (queueInfo == null)
            {
                throw new RpcException(new Status(StatusCode.NotFound, $"Queue not found: {request.QueueName}"));
            }
            await this.internalApi.DeleteQueue(queueInfo.Id);

            return(new DeleteQueueByNameResponse());
        }
Exemple #2
0
        public async Task DeleteQueueByName()
        {
            var client = await CreateClient();

            var createResponse = await client.CreateQueueAsync(new CreateQueueRequest { QueueName = "DeleteByName" });

            Assert.AreEqual(1, createResponse.QueueId);
            var request = new DeleteQueueByNameRequest {
                QueueName = "DeleteByName"
            };

            await client.DeleteQueueByNameAsync(request);

            var queueInfoAfter = await client.GetQueueInfoByNameAsync(new GetQueueInfoByNameRequest { QueueName = "DeleteByName" });

            Assert.IsFalse(queueInfoAfter.RecordFound);
        }