Skip to content

Orchestration Instance Management

Affan Dar edited this page Jan 30, 2015 · 1 revision

The TaskHubClient API allows users to create new orchestration instances, query for the state of created orchestration instances and terminate these instances.

The API for creating an orchestration instance will return the instance information. This information can be used in subsequent APIs to query for the state of the instance.

OrchestrationInstance instance = client.CreateOrchestrationInstance(typeof (EncodeVideoOrchestration), 
                                    "http://<azurebloblocation>/MyVideo.mpg");

OrchestrationState state = client.GetOrchestrationState(instance);
Console.WriteLine(state.Name + " " + state.OrchestrationStatus + " " + state.Output);

The returned instance can also be used to terminate the orchestration:

OrchestrationInstance instance = client.CreateOrchestrationInstance(typeof (EncodeVideoOrchestration), 
                                    "http://<azurebloblocation>/MyVideo.mpg");
// something bad happened
client.TerminateInstance(instance);

Note that the instance querying methods require the Task Hub to have been created with an Azure Storage connection string. If the connection string has not been supplied then all instance querying methods will throw an InvalidOperationException.