Skip to main content

ExternalTaskStore

Trait ExternalTaskStore 

Source
pub trait ExternalTaskStore: Send + Sync {
    // Required methods
    fn create<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        token_id: &'life1 str,
        process_instance_id: &'life2 str,
        task_type: &'life3 str,
        retries: i32,
        timeout_secs: u64,
        variables: HashMap<String, String>,
    ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn fetch_and_lock<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        worker_id: &'life1 str,
        task_types: &'life2 [String],
        max_tasks: usize,
        lock_duration: Duration,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ExternalTask>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn complete<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        task_id: &'life1 str,
        worker_id: &'life2 str,
        variables: HashMap<String, String>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn fail<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        task_id: &'life1 str,
        worker_id: &'life2 str,
        error: String,
        retry_after: Option<Duration>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn reclaim_expired_locks<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get<'life0, 'life1, 'async_trait>(
        &'life0 self,
        task_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<ExternalTask>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}

Required Methods§

Source

fn create<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, token_id: &'life1 str, process_instance_id: &'life2 str, task_type: &'life3 str, retries: i32, timeout_secs: u64, variables: HashMap<String, String>, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Create a READY external task when token arrives at ExternalTask node.

Source

fn fetch_and_lock<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, worker_id: &'life1 str, task_types: &'life2 [String], max_tasks: usize, lock_duration: Duration, ) -> Pin<Box<dyn Future<Output = Result<Vec<ExternalTask>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Fetch READY tasks matching task_types, lock to worker, return locked tasks.

Source

fn complete<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, task_id: &'life1 str, worker_id: &'life2 str, variables: HashMap<String, String>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Complete: LOCKED + lock_owner + not expired -> COMPLETED; merge variables.

Source

fn fail<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, task_id: &'life1 str, worker_id: &'life2 str, error: String, retry_after: Option<Duration>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Fail: retries -= 1; if retries > 0 -> READY else -> FAILED.

Source

fn reclaim_expired_locks<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Reclaim LOCKED tasks whose lock_expire_at < now to READY (plan §9).

Source

fn get<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<ExternalTask>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Load task by id (for REST layer after complete to get token_id/instance_id for transition).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§