Skip to content

Task Hub Management

Marley edited this page May 11, 2023 · 2 revisions

The TaskHubWorker has APIs that can be used to perform CRUD operations on the TaskHub itself.

string serviceBusConnString = "Endpoint=sb://<namespace>.servicebus.windows.net/;SharedSecretIssuer=[issuer];SharedSecretValue=[value]";

string tableConnectionString = "UseDevelopmentStorage=true;DevelopmentStorageProxyUri=http://127.0.0.1:10002/";

TaskHubWorker hubWorker = new TaskHubWorker("mytesthub", serviceBusConnString, tableConnectionString);

// creates the required underlying entities in Service Bus and Azure Storage for the task hub
hubWorker.CreateHub();

// creates the required underlying entities in Service Bus and Azure Storage for the task hub
// only if they don't already exist
hubWorker.CreateHubIfNotExists();

// deletes the underlying entities in Service Bus and Azure Storage for the task hub
hubWorker.DeleteHub();

// existence check
bool hubExists = hubWorker.HubExists();

The Azure Storage connection string is optional. If it is not supplied then the instance storage will not be created and consequently the instance data will not be available for querying.