Class TaskHubClient
- Namespace
- DurableTask.Core
- Assembly
- DurableTask.Core.dll
Client used to manage and query orchestration instances
public sealed class TaskHubClient
- Inheritance
-
TaskHubClient
- Inherited Members
Constructors
TaskHubClient(IOrchestrationServiceClient)
Create a new TaskHubClient with the given OrchestrationServiceClient
public TaskHubClient(IOrchestrationServiceClient serviceClient)
Parameters
serviceClient
IOrchestrationServiceClientObject implementing the IOrchestrationServiceClient interface
TaskHubClient(IOrchestrationServiceClient, JsonDataConverter)
Create a new TaskHubClient with the given OrchestrationServiceClient and JsonDataConverter.
public TaskHubClient(IOrchestrationServiceClient serviceClient, JsonDataConverter dataConverter)
Parameters
serviceClient
IOrchestrationServiceClientObject implementing the IOrchestrationServiceClient interface
dataConverter
JsonDataConverterThe JsonDataConverter to use for message serialization.
Properties
ServiceClient
The orchestration service client for this task hub client
public IOrchestrationServiceClient ServiceClient { get; }
Property Value
Methods
CreateOrchestrationInstanceAsync(string, string, object)
Create a new orchestration of the specified name and version
public Task<OrchestrationInstance> CreateOrchestrationInstanceAsync(string name, string version, object input)
Parameters
name
stringName of the TaskOrchestration
version
stringVersion of the TaskOrchestration
input
objectInput parameter to the specified TaskOrchestration
Returns
- Task<OrchestrationInstance>
OrchestrationInstance that represents the orchestration that was created
CreateOrchestrationInstanceAsync(string, string, string, object)
Create a new orchestration of the specified name and version
public Task<OrchestrationInstance> CreateOrchestrationInstanceAsync(string name, string version, string instanceId, object input)
Parameters
name
stringName of the orchestration as specified by the ObjectCreator
version
stringName of the orchestration as specified by the ObjectCreator
instanceId
stringInstance id for the orchestration to be created, must be unique across the Task Hub
input
objectInput parameter to the specified TaskOrchestration
Returns
- Task<OrchestrationInstance>
OrchestrationInstance that represents the orchestration that was created
CreateOrchestrationInstanceAsync(string, string, string, object, IDictionary<string, string>)
Create a new orchestration of the specified name and version
public Task<OrchestrationInstance> CreateOrchestrationInstanceAsync(string name, string version, string instanceId, object input, IDictionary<string, string> tags)
Parameters
name
stringName of the orchestration as specified by the ObjectCreator
version
stringName of the orchestration as specified by the ObjectCreator
instanceId
stringInstance id for the orchestration to be created, must be unique across the Task Hub
input
objectInput parameter to the specified TaskOrchestration
tags
IDictionary<string, string>Dictionary of key/value tags associated with this instance
Returns
- Task<OrchestrationInstance>
OrchestrationInstance that represents the orchestration that was created
CreateOrchestrationInstanceAsync(string, string, string, object, IDictionary<string, string>, OrchestrationStatus[])
Create a new orchestration of the specified name and version
public Task<OrchestrationInstance> CreateOrchestrationInstanceAsync(string name, string version, string instanceId, object input, IDictionary<string, string> tags, OrchestrationStatus[] dedupeStatuses)
Parameters
name
stringName of the orchestration as specified by the ObjectCreator
version
stringName of the orchestration as specified by the ObjectCreator
instanceId
stringInstance id for the orchestration to be created, must be unique across the Task Hub
input
objectInput parameter to the specified TaskOrchestration
tags
IDictionary<string, string>Dictionary of key/value tags associated with this instance
dedupeStatuses
OrchestrationStatus[]States of previous orchestration executions to be considered while de-duping new orchestrations on the client
Returns
- Task<OrchestrationInstance>
OrchestrationInstance that represents the orchestration that was created
CreateOrchestrationInstanceAsync(Type, object)
Create a new orchestration of the specified type with an automatically generated instance id
public Task<OrchestrationInstance> CreateOrchestrationInstanceAsync(Type orchestrationType, object input)
Parameters
orchestrationType
TypeType that derives from TaskOrchestration
input
objectInput parameter to the specified TaskOrchestration
Returns
- Task<OrchestrationInstance>
OrchestrationInstance that represents the orchestration that was created
CreateOrchestrationInstanceAsync(Type, string, object)
Create a new orchestration of the specified type with the specified instance id
public Task<OrchestrationInstance> CreateOrchestrationInstanceAsync(Type orchestrationType, string instanceId, object input)
Parameters
orchestrationType
TypeType that derives from TaskOrchestration
instanceId
stringInstance id for the orchestration to be created, must be unique across the Task Hub
input
objectInput parameter to the specified TaskOrchestration
Returns
- Task<OrchestrationInstance>
OrchestrationInstance that represents the orchestration that was created
CreateOrchestrationInstanceAsync(Type, string, object, OrchestrationStatus[])
Create a new orchestration of the specified type with the specified instance id
public Task<OrchestrationInstance> CreateOrchestrationInstanceAsync(Type orchestrationType, string instanceId, object input, OrchestrationStatus[] dedupeStatuses)
Parameters
orchestrationType
TypeType that derives from TaskOrchestration
instanceId
stringInstance id for the orchestration to be created, must be unique across the Task Hub
input
objectInput parameter to the specified TaskOrchestration
dedupeStatuses
OrchestrationStatus[]States of previous orchestration executions to be considered while de-duping new orchestrations on the client
Returns
- Task<OrchestrationInstance>
OrchestrationInstance that represents the orchestration that was created
CreateOrchestrationInstanceWithRaisedEventAsync(string, string, object, string, object)
Creates an orchestration instance, and raises an event for it, which eventually causes the OnEvent() method in the orchestration to fire.
public Task<OrchestrationInstance> CreateOrchestrationInstanceWithRaisedEventAsync(string orchestrationName, string orchestrationVersion, object orchestrationInput, string eventName, object eventData)
Parameters
orchestrationName
stringName of the TaskOrchestration
orchestrationVersion
stringVersion of the TaskOrchestration
orchestrationInput
objectInput parameter to the specified TaskOrchestration
eventName
stringName of the event
eventData
objectData for the event
Returns
- Task<OrchestrationInstance>
OrchestrationInstance that represents the orchestration that was created
CreateOrchestrationInstanceWithRaisedEventAsync(string, string, string, object)
Creates an orchestration instance, and raises an event for it, which eventually causes the OnEvent() method in the orchestration to fire.
public Task<OrchestrationInstance> CreateOrchestrationInstanceWithRaisedEventAsync(string orchestrationName, string orchestrationVersion, string eventName, object eventData)
Parameters
orchestrationName
stringName of the orchestration as specified by the ObjectCreator
orchestrationVersion
stringName of the orchestration as specified by the ObjectCreator
eventName
stringName of the event
eventData
objectData for the event
Returns
CreateOrchestrationInstanceWithRaisedEventAsync(string, string, string, object, IDictionary<string, string>, OrchestrationStatus[], string, object)
Creates an orchestration instance, and raises an event for it, which eventually causes the OnEvent() method in the orchestration to fire.
public Task<OrchestrationInstance> CreateOrchestrationInstanceWithRaisedEventAsync(string orchestrationName, string orchestrationVersion, string instanceId, object orchestrationInput, IDictionary<string, string> orchestrationTags, OrchestrationStatus[] dedupeStatuses, string eventName, object eventData)
Parameters
orchestrationName
stringName of the TaskOrchestration
orchestrationVersion
stringVersion of the TaskOrchestration
instanceId
stringInstance id for the orchestration to be created, must be unique across the Task Hub
orchestrationInput
objectInput parameter to the specified TaskOrchestration
orchestrationTags
IDictionary<string, string>Dictionary of key/value tags associated with this instance
dedupeStatuses
OrchestrationStatus[]States of previous orchestration executions to be considered while de-duping new orchestrations on the client
eventName
stringName of the event
eventData
objectData for the event
Returns
- Task<OrchestrationInstance>
OrchestrationInstance that represents the orchestration that was created
CreateOrchestrationInstanceWithRaisedEventAsync(string, string, string, object, IDictionary<string, string>, string, object)
Creates an orchestration instance, and raises an event for it, which eventually causes the OnEvent() method in the orchestration to fire.
public Task<OrchestrationInstance> CreateOrchestrationInstanceWithRaisedEventAsync(string orchestrationName, string orchestrationVersion, string instanceId, object orchestrationInput, IDictionary<string, string> orchestrationTags, string eventName, object eventData)
Parameters
orchestrationName
stringName of the TaskOrchestration
orchestrationVersion
stringVersion of the TaskOrchestration
instanceId
stringInstance id for the orchestration to be created, must be unique across the Task Hub
orchestrationInput
objectInput parameter to the specified TaskOrchestration
orchestrationTags
IDictionary<string, string>Dictionary of key/value tags associated with this instance
eventName
stringName of the event
eventData
objectData for the event
Returns
- Task<OrchestrationInstance>
OrchestrationInstance that represents the orchestration that was created
CreateOrchestrationInstanceWithRaisedEventAsync(string, string, string, object, string, object)
Creates an orchestration instance, and raises an event for it, which eventually causes the OnEvent() method in the orchestration to fire.
public Task<OrchestrationInstance> CreateOrchestrationInstanceWithRaisedEventAsync(string orchestrationName, string orchestrationVersion, string instanceId, object orchestrationInput, string eventName, object eventData)
Parameters
orchestrationName
stringName of the TaskOrchestration
orchestrationVersion
stringVersion of the TaskOrchestration
instanceId
stringInstance id for the orchestration to be created, must be unique across the Task Hub
orchestrationInput
objectInput parameter to the specified TaskOrchestration
eventName
stringName of the event
eventData
objectData for the event
Returns
- Task<OrchestrationInstance>
OrchestrationInstance that represents the orchestration that was created
CreateOrchestrationInstanceWithRaisedEventAsync(string, string, string, string, object)
Creates an orchestration instance, and raises an event for it, which eventually causes the OnEvent() method in the orchestration to fire.
public Task<OrchestrationInstance> CreateOrchestrationInstanceWithRaisedEventAsync(string orchestrationName, string orchestrationVersion, string instanceId, string eventName, object eventData)
Parameters
orchestrationName
stringName of the orchestration as specified by the ObjectCreator
orchestrationVersion
stringName of the orchestration as specified by the ObjectCreator
instanceId
stringInstance id for the orchestration to be created, must be unique across the Task Hub
eventName
stringName of the event
eventData
objectData for the event
Returns
CreateOrchestrationInstanceWithRaisedEventAsync(Type, object, string, object)
Creates an orchestration instance, and raises an event for it, which eventually causes the OnEvent() method in the orchestration to fire.
public Task<OrchestrationInstance> CreateOrchestrationInstanceWithRaisedEventAsync(Type orchestrationType, object orchestrationInput, string eventName, object eventData)
Parameters
orchestrationType
TypeType that derives from TaskOrchestration
orchestrationInput
objectInput parameter to the specified TaskOrchestration
eventName
stringName of the event
eventData
objectData for the event
Returns
- Task<OrchestrationInstance>
OrchestrationInstance that represents the orchestration that was created
CreateOrchestrationInstanceWithRaisedEventAsync(Type, string, object, OrchestrationStatus[], string, object)
Creates an orchestration instance, and raises an event for it, which eventually causes the OnEvent() method in the orchestration to fire.
public Task<OrchestrationInstance> CreateOrchestrationInstanceWithRaisedEventAsync(Type orchestrationType, string instanceId, object orchestrationInput, OrchestrationStatus[] dedupeStatuses, string eventName, object eventData)
Parameters
orchestrationType
TypeType that derives from TaskOrchestration
instanceId
stringInstance id for the orchestration to be created, must be unique across the Task Hub
orchestrationInput
objectInput parameter to the specified TaskOrchestration
dedupeStatuses
OrchestrationStatus[]States of previous orchestration executions to be considered while de-duping new orchestrations on the client
eventName
stringName of the event
eventData
objectData for the event
Returns
- Task<OrchestrationInstance>
OrchestrationInstance that represents the orchestration that was created
CreateOrchestrationInstanceWithRaisedEventAsync(Type, string, object, string, object)
Creates an orchestration instance, and raises an event for it, which eventually causes the OnEvent() method in the orchestration to fire.
public Task<OrchestrationInstance> CreateOrchestrationInstanceWithRaisedEventAsync(Type orchestrationType, string instanceId, object orchestrationInput, string eventName, object eventData)
Parameters
orchestrationType
TypeType that derives from TaskOrchestration
instanceId
stringInstance id for the orchestration to be created, must be unique across the Task Hub
orchestrationInput
objectInput parameter to the specified TaskOrchestration
eventName
stringName of the event
eventData
objectData for the event
Returns
- Task<OrchestrationInstance>
OrchestrationInstance that represents the orchestration that was created
GetOrchestrationHistoryAsync(OrchestrationInstance)
Get a string dump of the execution history of the specified orchestration instance specified execution (generation) of the specified instance.
public Task<string> GetOrchestrationHistoryAsync(OrchestrationInstance instance)
Parameters
instance
OrchestrationInstanceInstance
Returns
Exceptions
- InvalidOperationException
Thrown if instance store not configured
GetOrchestrationStateAsync(OrchestrationInstance)
Get a list of orchestration states from the instance storage table for the most current execution (generation) of the specified instance.
public Task<OrchestrationState> GetOrchestrationStateAsync(OrchestrationInstance instance)
Parameters
instance
OrchestrationInstanceInstance
Returns
- Task<OrchestrationState>
The OrchestrationState of the specified instanceId or null if not found
Exceptions
- InvalidOperationException
Thrown if instance store not configured
GetOrchestrationStateAsync(string)
Get a list of orchestration states from the instance storage table for the most current execution (generation) of the specified instance.
public Task<OrchestrationState> GetOrchestrationStateAsync(string instanceId)
Parameters
instanceId
stringInstance id
Returns
- Task<OrchestrationState>
The OrchestrationState of the specified instanceId or null if not found
Exceptions
- InvalidOperationException
Thrown if instance store not configured
GetOrchestrationStateAsync(string, bool)
Get a list of orchestration states from the instance storage table for either the most current or all executions (generations) of the specified instance.
public Task<IList<OrchestrationState>> GetOrchestrationStateAsync(string instanceId, bool allExecutions)
Parameters
instanceId
stringInstance id
allExecutions
boolTrue if method should fetch all executions of the instance, false if the method should only fetch the most recent execution
Returns
- Task<IList<OrchestrationState>>
List of OrchestrationState objects that represents the list of orchestrations in the instance store
Exceptions
- InvalidOperationException
Thrown if instance store not configured
GetOrchestrationStateAsync(string, string)
Get a list of orchestration states from the instance storage table for the specified execution (generation) of the specified instance.
public Task<OrchestrationState> GetOrchestrationStateAsync(string instanceId, string executionId)
Parameters
Returns
- Task<OrchestrationState>
The OrchestrationState of the specified instanceId or null if not found
Exceptions
- InvalidOperationException
Thrown if instance store not configured
PurgeOrchestrationInstanceHistoryAsync(DateTime, OrchestrationStateTimeRangeFilterType)
Purges orchestration instance state and history for orchestrations older than the specified threshold time.
public Task PurgeOrchestrationInstanceHistoryAsync(DateTime thresholdDateTimeUtc, OrchestrationStateTimeRangeFilterType timeRangeFilterType)
Parameters
thresholdDateTimeUtc
DateTimeThreshold date time in UTC
timeRangeFilterType
OrchestrationStateTimeRangeFilterTypeWhat to compare the threshold date time against
Returns
Exceptions
- InvalidOperationException
Thrown if instance store not configured
RaiseEventAsync(OrchestrationInstance, string, object)
Raises an event in the specified orchestration instance, which eventually causes the OnEvent() method in the orchestration to fire.
public Task RaiseEventAsync(OrchestrationInstance orchestrationInstance, string eventName, object eventData)
Parameters
orchestrationInstance
OrchestrationInstanceInstance in which to raise the event
eventName
stringName of the event
eventData
objectData for the event
Returns
TerminateInstanceAsync(OrchestrationInstance)
Forcefully terminate the specified orchestration instance
public Task TerminateInstanceAsync(OrchestrationInstance orchestrationInstance)
Parameters
orchestrationInstance
OrchestrationInstanceInstance to terminate
Returns
TerminateInstanceAsync(OrchestrationInstance, string)
Forcefully terminate the specified orchestration instance with a reason
public Task TerminateInstanceAsync(OrchestrationInstance orchestrationInstance, string reason)
Parameters
orchestrationInstance
OrchestrationInstanceInstance to terminate
reason
stringReason for terminating the instance
Returns
WaitForOrchestrationAsync(OrchestrationInstance, TimeSpan)
Wait for an orchestration to reach any terminal state within the given timeout
public Task<OrchestrationState> WaitForOrchestrationAsync(OrchestrationInstance orchestrationInstance, TimeSpan timeout)
Parameters
orchestrationInstance
OrchestrationInstanceInstance to terminate
timeout
TimeSpanMax timeout to wait
Returns
WaitForOrchestrationAsync(OrchestrationInstance, TimeSpan, CancellationToken)
Wait for an orchestration to reach any terminal state within the given timeout
public Task<OrchestrationState> WaitForOrchestrationAsync(OrchestrationInstance orchestrationInstance, TimeSpan timeout, CancellationToken cancellationToken)
Parameters
orchestrationInstance
OrchestrationInstanceInstance to terminate
timeout
TimeSpanMax timeout to wait
cancellationToken
CancellationTokenTask cancellation token