Esempio n. 1
0
        /// <summary>
        ///     Deletes all the underlying Service Bus entities.
        /// </summary>
        /// <param name="deleteInstanceStore">True if Azure Storage entities should also deleted, False otherwise.</param>
        public void DeleteHub(bool deleteInstanceStore)
        {
            NamespaceManager namespaceManager = NamespaceManager.CreateFromConnectionString(connectionString);

            SafeDeleteQueue(namespaceManager, orchestratorEntityName);
            SafeDeleteQueue(namespaceManager, workerEntityName);
            SafeDeleteQueue(namespaceManager, trackingEntityName);

            if (deleteInstanceStore)
            {
                if (!string.IsNullOrEmpty(tableStoreConnectionString))
                {
                    var client = new TableClient(hubName, tableStoreConnectionString);
                    client.DeleteTableIfExists();
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        ///     Creates all the underlying entities in Service bus and Azure Storage (if specified) for
        ///     the TaskHubWorker and TaskHubClient's operations. If TaskHub already existed then
        ///     it would be deleted and recreated. Instance store creation can be controlled via parameter.
        /// </summary>
        public void CreateHub(TaskHubDescription description, bool createInstanceStore)
        {
            NamespaceManager namespaceManager = NamespaceManager.CreateFromConnectionString(connectionString);

            SafeDeleteQueue(namespaceManager, orchestratorEntityName);
            SafeDeleteQueue(namespaceManager, workerEntityName);
            SafeDeleteQueue(namespaceManager, trackingEntityName);

            CreateQueue(namespaceManager, orchestratorEntityName, true, description.MaxTaskOrchestrationDeliveryCount);
            CreateQueue(namespaceManager, workerEntityName, false, description.MaxTaskActivityDeliveryCount);
            CreateQueue(namespaceManager, trackingEntityName, true, description.MaxTrackingDeliveryCount);

            if (!string.IsNullOrEmpty(tableStoreConnectionString) && createInstanceStore)
            {
                var client = new TableClient(hubName, tableStoreConnectionString);
                client.DeleteTableIfExists();
                client.CreateTableIfNotExists();
            }
        }