pub struct CallbackHandle {
pub callback_id: String,
/* private fields */
}Expand description
Handle returned by [DurableContext::create_callback] containing the
server-generated callback ID.
The callback_id is used by external systems to signal the callback
via SendDurableExecutionCallbackSuccess, SendDurableExecutionCallbackFailure,
or SendDurableExecutionCallbackHeartbeat APIs.
Pass this handle to [DurableContext::callback_result] to retrieve the
callback result or suspend if the callback hasn’t been signaled yet.
§Two-phase callback protocol — two separate operation IDs
Invocation 1:
create_callback("approval", opts) → op_id: blake2b("1") → START + SUCCEED (returns handle)
callback_result(&handle) → op_id: blake2b("2") → START → SUSPEND (Lambda exits)
External system calls SendDurableExecutionCallbackSuccess(callback_id) ...
Invocation 2 (re-invoked by server):
create_callback("approval", opts) → op_id: blake2b("1") → REPLAY (cached SUCCEED)
callback_result(&handle) → op_id: blake2b("2") → REPLAY (cached result)
[workflow continues]§Examples
use durable_lambda_core::types::CallbackOptions;
let handle = ctx.create_callback("approval", CallbackOptions::new()).await?;
println!("Send this to the external system: {}", handle.callback_id);
// Later, check the result (suspends if not yet signaled).
let result: String = ctx.callback_result(&handle)?;Fields§
§callback_id: StringThe server-generated callback ID for external systems.
Trait Implementations§
Source§impl Clone for CallbackHandle
impl Clone for CallbackHandle
Source§fn clone(&self) -> CallbackHandle
fn clone(&self) -> CallbackHandle
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CallbackHandle
impl RefUnwindSafe for CallbackHandle
impl Send for CallbackHandle
impl Sync for CallbackHandle
impl Unpin for CallbackHandle
impl UnsafeUnpin for CallbackHandle
impl UnwindSafe for CallbackHandle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.