DurableOrchestrationClient Class
Durable Orchestration Client.
Client for starting, querying, terminating and raising events to orchestration instances.
- Inheritance
-
builtins.objectDurableOrchestrationClient
Constructor
DurableOrchestrationClient(context: str)
Parameters
- context
Methods
| create_check_status_response |
Create a HttpResponse that contains useful information for checking the status of the specified instance. |
| create_http_management_payload |
Create a dictionary of orchestrator management urls. |
| get_client_response_links |
Create a dictionary of orchestrator management urls. |
| get_status |
Get the status of the specified orchestration instance. |
| get_status_all |
Get the status of all orchestration instances. |
| get_status_by |
Get the status of all orchestration instances that match the specified conditions. |
| purge_instance_history |
Delete the history of the specified orchestration instance. |
| purge_instance_history_by |
Delete the history of all orchestration instances that match the specified conditions. |
| raise_event |
Send an event notification message to a waiting orchestration instance. In order to handle the event, the target orchestration instance must be waiting for an event named eventName using waitForExternalEvent API. |
| rewind |
Return / "rewind" a failed orchestration instance to a prior "healthy" state. |
| start_new |
Start a new instance of the specified orchestrator function. If an orchestration instance with the specified ID already exists, the existing instance will be silently replaced by this new instance. |
| terminate |
Terminate the specified orchestration instance. |
| wait_for_completion_or_create_check_status_response |
Create an HTTP response. The response either contains a payload of management URLs for a non-completed instance or contains the payload containing the output of the completed orchestration. If the orchestration does not complete within the specified timeout, then the HTTP response will be identical to that of [[createCheckStatusResponse]]. |
create_check_status_response
Create a HttpResponse that contains useful information for checking the status of the specified instance.
create_check_status_response(request: azure.functions._http.HttpRequest, instance_id: str) -> azure.functions._http.HttpResponse
Parameters
- request
- <xref:HttpRequest>
The HTTP request that triggered the current orchestration instance.
Returns
An HTTP 202 response with a Location header and a payload containing instance management URLs
Return type
create_http_management_payload
Create a dictionary of orchestrator management urls.
create_http_management_payload(instance_id: str) -> Dict[str, str]
Parameters
Returns
a dictionary object of orchestrator instance management urls
Return type
get_client_response_links
Create a dictionary of orchestrator management urls.
get_client_response_links(request: Optional[azure.functions._http.HttpRequest], instance_id: str) -> Dict[str, str]
Parameters
- request
- <xref:Optional>[<xref:HttpRequest>]
The HTTP request that triggered the current orchestration instance.
Returns
a dictionary object of orchestrator instance management urls
Return type
get_status
Get the status of the specified orchestration instance.
async get_status(instance_id: str, show_history: bool = False, show_history_output: bool = False, show_input: bool = False) -> azure.durable_functions.models.DurableOrchestrationStatus.DurableOrchestrationStatus
Parameters
- show_history
- bool
Boolean marker for including execution history in the response.
- show_history_output
- bool
Boolean marker for including output in the execution history response.
Returns
The status of the requested orchestration instance
Return type
get_status_all
Get the status of all orchestration instances.
async get_status_all() -> List[azure.durable_functions.models.DurableOrchestrationStatus.DurableOrchestrationStatus]
Returns
The status of the requested orchestration instances
Return type
get_status_by
Get the status of all orchestration instances that match the specified conditions.
async get_status_by(created_time_from: Optional[datetime.datetime] = None, created_time_to: Optional[datetime.datetime] = None, runtime_status: Optional[List[azure.durable_functions.models.OrchestrationRuntimeStatus.OrchestrationRuntimeStatus]] = None) -> List[azure.durable_functions.models.DurableOrchestrationStatus.DurableOrchestrationStatus]
Parameters
- created_time_from
- datetime
Return orchestration instances which were created after this Date.
- created_time_to
- datetime
Return orchestration instances which were created before this Date.
- runtime_status
- <xref:List>[OrchestrationRuntimeStatus]
Return orchestration instances which match any of the runtimeStatus values in this list.
Returns
The status of the requested orchestration instances
Return type
purge_instance_history
Delete the history of the specified orchestration instance.
async purge_instance_history(instance_id: str) -> azure.durable_functions.models.PurgeHistoryResult.PurgeHistoryResult
Parameters
Returns
The results of the request to delete the orchestration instance
Return type
purge_instance_history_by
Delete the history of all orchestration instances that match the specified conditions.
async purge_instance_history_by(created_time_from: Optional[datetime.datetime] = None, created_time_to: Optional[datetime.datetime] = None, runtime_status: Optional[List[azure.durable_functions.models.OrchestrationRuntimeStatus.OrchestrationRuntimeStatus]] = None) -> azure.durable_functions.models.PurgeHistoryResult.PurgeHistoryResult
Parameters
- created_time_from
- <xref:Optional>[datetime]
Delete orchestration history which were created after this Date.
- created_time_to
- <xref:Optional>[datetime]
Delete orchestration history which were created before this Date.
- runtime_status
- <xref:Optional>[<xref:List>[OrchestrationRuntimeStatus]]
Delete orchestration instances which match any of the runtimeStatus values in this list.
Returns
The results of the request to purge history
Return type
raise_event
Send an event notification message to a waiting orchestration instance.
In order to handle the event, the target orchestration instance must be waiting for an event named eventName using waitForExternalEvent API.
async raise_event(instance_id: str, event_name: str, event_data: Optional[Any] = None, task_hub_name: Optional[str] = None, connection_name: Optional[str] = None) -> None
Parameters
- event_data
- <xref:Any>, <xref:optional>
The JSON-serializable data associated with the event.
- task_hub_name
- str, <xref:optional>
The TaskHubName of the orchestration that will handle the event.
- connection_name
- str, <xref:optional>
The name of the connection string associated with taskHubName.
Exceptions
event name must be a valid string.
Raises an exception if the status code is 404 or 400 when raising the event.
rewind
Return / "rewind" a failed orchestration instance to a prior "healthy" state.
async rewind(instance_id: str, reason: str, task_hub_name: Optional[str] = None, connection_name: Optional[str] = None)
Parameters
- connection_name
- <xref:Optional>[str]
Name of the application setting containing the storage connection string to use.
Exceptions
In case of a failure, it reports the reason for the exception
start_new
Start a new instance of the specified orchestrator function.
If an orchestration instance with the specified ID already exists, the existing instance will be silently replaced by this new instance.
async start_new(orchestration_function_name: str, instance_id: Optional[str] = None, client_input: Optional[Any] = None) -> str
Parameters
- instance_id
- <xref:Optional>[str]
The ID to use for the new orchestration instance. If no instance id is specified, the Durable Functions extension will generate a random GUID (recommended).
- client_input
- <xref:Optional>[<xref:Any>]
JSON-serializable input value for the orchestrator function.
Returns
The ID of the new orchestration instance if successful, None if not.
Return type
terminate
Terminate the specified orchestration instance.
async terminate(instance_id: str, reason: str) -> None
Parameters
Return type
Exceptions
When the terminate call failed with an unexpected status code
wait_for_completion_or_create_check_status_response
Create an HTTP response.
The response either contains a payload of management URLs for a non-completed instance or contains the payload containing the output of the completed orchestration.
If the orchestration does not complete within the specified timeout, then the HTTP response will be identical to that of [[createCheckStatusResponse]].
async wait_for_completion_or_create_check_status_response(request, instance_id: str, timeout_in_milliseconds: int = 10000, retry_interval_in_milliseconds: int = 1000) -> azure.functions._http.HttpResponse
Parameters
- request
The HTTP request that triggered the current function.
- instance_id
The unique ID of the instance to check.
- timeout_in_milliseconds
Total allowed timeout for output from the durable function. The default value is 10 seconds.
- retry_interval_in_milliseconds
The timeout between checks for output from the durable function. The default value is 1 second.
Feedback
Submit and view feedback for