/// <summary> /// Creates all the underlying entities in Service bus and Azure Storage (if specified) for /// the TaskHubWorker and TaskHubClient's operations. If TaskHub already exists then this is a no-op /// </summary> public void CreateHubIfNotExists(TaskHubDescription description) { NamespaceManager namespaceManager = NamespaceManager.CreateFromConnectionString(connectionString); IEnumerable <QueueDescription> queueDescriptions = namespaceManager.GetQueues("startswith(path, '" + hubName + "') eq TRUE"); List <QueueDescription> descriptions = queueDescriptions.ToList(); if (!descriptions.Any(q => string.Equals(q.Path, orchestratorEntityName))) { SafeCreateQueue(namespaceManager, orchestratorEntityName, true, description.MaxTaskOrchestrationDeliveryCount); } if (!descriptions.Any(q => string.Equals(q.Path, workerEntityName))) { SafeCreateQueue(namespaceManager, workerEntityName, false, description.MaxTaskActivityDeliveryCount); } if (!descriptions.Any(q => string.Equals(q.Path, trackingEntityName))) { SafeCreateQueue(namespaceManager, trackingEntityName, true, description.MaxTrackingDeliveryCount); } if (!string.IsNullOrEmpty(tableStoreConnectionString)) { var client = new TableClient(hubName, tableStoreConnectionString); client.CreateTableIfNotExists(); } }
public void TestInitialize() { var r = new Random(); tableClient = new TableClient("test00" + r.Next(0, 10000), "UseDevelopmentStorage=true;DevelopmentStorageProxyUri=http://127.0.0.1:10002/"); tableClient.CreateTableIfNotExists(); client = TestHelpers.CreateTaskHubClient(); taskHub = TestHelpers.CreateTaskHub(); taskHub.DeleteHub(); taskHub.CreateHubIfNotExists(); }
/// <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(); } }