[−][src]Struct azure_functions::bindings::DurableOrchestrationContext
Represents the Durable Functions orchestration context binding.
The following binding attributes are supported:
Name | Description |
---|---|
name | The name of the parameter being bound. |
orchestration | The name of the orchestration. Defaults to the name of the function. |
Examples
Calling multiple activities and waiting for them all to complete:
use azure_functions::{bindings::DurableOrchestrationContext, durable::OrchestrationOutput, func}; use serde_json::Value; use log::error; #[func] pub async fn run(context: DurableOrchestrationContext) -> OrchestrationOutput { let activities = vec![ context.call_activity("say_hello", "Tokyo"), context.call_activity("say_hello", "London"), context.call_activity("say_hello", "Seattle"), ]; context.set_custom_status("Waiting for all activities to complete."); let result: Value = context .join_all(activities) .await .into_iter() .filter_map(|r| { r.map(Some).unwrap_or_else(|e| { error!("Activity failed: {}", e); None }) }) .collect::<Vec<_>>() .into(); context.set_custom_status("All activities have completed."); result.into() }
Fields
instance_id: String
The orchestration instance identifier.
parent_instance_id: Option<String>
The parent orchestration instance identifier.
input: Value
The input value to the orchestration.
Methods
impl DurableOrchestrationContext
[src]
pub fn is_replaying(&self) -> bool
[src]
Gets a value indicating whether the orchestrator function is currently replaying itself.
pub fn current_time(&self) -> DateTime<Utc>
[src]
Gets the current date/time in a way that is safe for use by orchestrator functions.
pub fn set_custom_status<S>(&self, status: S) where
S: Into<Value>,
[src]
S: Into<Value>,
Sets the custom status of the orchestration.
pub fn new_guid(&self) -> Uuid
[src]
Create a new deterministic GUID suitable for use with orchestrations.
ⓘImportant traits for JoinAll<F>#[must_use = "futures do nothing unless you `.await` or poll them"]
pub fn join_all<I>(&self, iter: I) -> JoinAll<I::Item> where
I: IntoIterator,
I::Item: OrchestrationFuture,
[src]
I: IntoIterator,
I::Item: OrchestrationFuture,
Creates a future which represents a collection of the outputs of the futures given.
The returned future will drive execution for all of its underlying futures,
collecting the results into a destination Vec<T>
in the same order as they
were provided.
ⓘImportant traits for SelectAll<F>pub fn select_all<I>(&self, iter: I) -> SelectAll<I::Item> where
I: IntoIterator,
I::Item: OrchestrationFuture,
[src]
I: IntoIterator,
I::Item: OrchestrationFuture,
Creates a new future which will select over a list of futures.
The returned future will wait for any future within iter
to be ready. Upon
completion the item resolved will be returned, along with the index of the
future that was ready and the list of all the remaining futures.
Panics
This function will panic if the iterator specified contains no items.
ⓘImportant traits for ActionFuture<T>#[must_use = "futures do nothing unless you `.await` or poll them"]
pub fn call_activity<D>(
&self,
activity_name: &str,
data: D
) -> ActionFuture<Result<Value, String>> where
D: Into<Value>,
[src]
&self,
activity_name: &str,
data: D
) -> ActionFuture<Result<Value, String>> where
D: Into<Value>,
Schedules an activity function for execution.
ⓘImportant traits for ActionFuture<T>#[must_use = "futures do nothing unless you `.await` or poll them"]
pub fn call_activity_with_retry<D>(
&self,
activity_name: &str,
data: D,
retry_options: RetryOptions
) -> ActionFuture<Result<Value, String>> where
D: Into<Value>,
[src]
&self,
activity_name: &str,
data: D,
retry_options: RetryOptions
) -> ActionFuture<Result<Value, String>> where
D: Into<Value>,
Schedules an activity function for execution with retry options.
ⓘImportant traits for ActionFuture<T>#[must_use = "futures do nothing unless you `.await` or poll them"]
pub fn call_sub_orchestrator<D>(
&self,
function_name: &str,
instance_id: Option<String>,
data: D
) -> ActionFuture<Result<Value, String>> where
D: Into<Value>,
[src]
&self,
function_name: &str,
instance_id: Option<String>,
data: D
) -> ActionFuture<Result<Value, String>> where
D: Into<Value>,
Schedules an orchestration function for execution.
ⓘImportant traits for ActionFuture<T>#[must_use = "futures do nothing unless you `.await` or poll them"]
pub fn call_sub_orchestrator_with_retry<D>(
&self,
function_name: &str,
instance_id: Option<String>,
data: D,
retry_options: RetryOptions
) -> ActionFuture<Result<Value, String>> where
D: Into<Value>,
[src]
&self,
function_name: &str,
instance_id: Option<String>,
data: D,
retry_options: RetryOptions
) -> ActionFuture<Result<Value, String>> where
D: Into<Value>,
Schedules an orchestration function for execution with retry.
pub fn continue_as_new<D>(&self, input: D, preserve_unprocessed_events: bool) where
D: Into<Value>,
[src]
D: Into<Value>,
Restarts the orchestration by clearing its history.
ⓘImportant traits for ActionFuture<T>#[must_use = "futures do nothing unless you `.await` or poll them"]
pub fn create_timer(&self, fire_at: DateTime<Utc>) -> ActionFuture<()>
[src]
Creates a durable timer that expires at a specified time.
ⓘImportant traits for ActionFuture<T>pub fn wait_for_event(&self, name: &str) -> ActionFuture<Result<Value, String>>
[src]
Wait for an external event of the given name.
Auto Trait Implementations
impl !Send for DurableOrchestrationContext
impl !Sync for DurableOrchestrationContext
impl Unpin for DurableOrchestrationContext
impl !UnwindSafe for DurableOrchestrationContext
impl !RefUnwindSafe for DurableOrchestrationContext
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> IntoRequest<T> for T
[src]
fn into_request(self) -> Request<T>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,