/// <summary> /// Gets a count for the specified queue/topic. /// </summary> /// <param name="entityName">Name of the entity to count on.</param> /// <returns>Task<EntityMessageCount>.</returns> public async Task <EntityMessageCount> EntityCount(string entityName) { var isTopic = await ManagerClient.IsTopic(entityName); return(isTopic ? await ManagerClient.GetTopicMessageCount(entityName) : await ManagerClient.GetQueueMessageCount(entityName)); }
/// <summary> /// Check the queue entity exists. /// </summary> /// <param name="entityName">The entity name to check exists.</param> /// <returns>Boolean true if exists and false if not.</returns> public async Task <bool> EntityExists(string entityName) { var isTopic = await ManagerClient.IsTopic(entityName); if (isTopic) { return(await ManagerClient.TopicExistsAsync(entityName)); } else { return(await ManagerClient.QueueExistsAsync(entityName)); } }
/// <summary> /// Purges the entity of all messages (very crude - will purge all queues). /// </summary> /// <param name="entityName">Name of the entity to purge.</param> /// <param name="preserveState">if set to <c>true</c> [preserve state while purging] - ONLY RELEVANT FOR TOPICS.</param> /// <returns>Task.</returns> public async Task EntityFullPurge(string entityName, bool preserveState = true) { var isTopic = await ManagerClient.IsTopic(entityName); if (isTopic) { await ManagerClient.PurgeTopic(entityName, preserveState); } else { await ManagerClient.PurgeQueue(entityName); } }
/// <summary> /// Deletes a topic subscription entity. /// </summary> /// <param name="entityName">Name of the topic entity.</param> /// <returns>Task.</returns> public async Task DeleteEntity(string entityName) { var isTopic = await ManagerClient.IsTopic(entityName); if (isTopic) { await ManagerClient.DeleteTopicIfExists(entityName); } else { await ManagerClient.DeleteQueueIfExists(entityName); } }