pub struct FlowWorker { /* private fields */ }Expand description
Worker that handles queued workflow tasks against a FlowEngine.
Implementations§
Source§impl FlowWorker
impl FlowWorker
pub fn new(engine: FlowEngine, queue: Arc<dyn FlowTaskQueue>) -> Self
pub fn in_memory(engine: FlowEngine) -> Self
pub fn engine(&self) -> &FlowEngine
pub fn queue(&self) -> Arc<dyn FlowTaskQueue> ⓘ
Sourcepub fn with_heartbeat_interval(self, interval: Duration) -> Result<Self>
pub fn with_heartbeat_interval(self, interval: Duration) -> Result<Self>
Enables periodic lease heartbeats while a task is being handled.
Every successful heartbeat rotates the lease fencing token. If a heartbeat reports that the lease was lost, the in-progress handling future is dropped and its outcome is not acknowledged.
pub fn heartbeat_interval(&self) -> Option<Duration>
pub async fn enqueue(&self, task: FlowTask) -> Result<()>
pub async fn handle(&self, task: FlowTask) -> Result<FlowTaskOutcome>
pub async fn run_once(&self) -> Result<Option<FlowTaskOutcome>>
pub async fn run_until_idle(&self) -> Result<Vec<FlowTaskOutcome>>
Trait Implementations§
Source§impl Clone for FlowWorker
impl Clone for FlowWorker
Source§fn clone(&self) -> FlowWorker
fn clone(&self) -> FlowWorker
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 !RefUnwindSafe for FlowWorker
impl !UnwindSafe for FlowWorker
impl Freeze for FlowWorker
impl Send for FlowWorker
impl Sync for FlowWorker
impl Unpin for FlowWorker
impl UnsafeUnpin for FlowWorker
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