Trait temporal_sdk_core::Core[][src]

pub trait Core: Send + Sync {
    #[must_use]
    fn poll_workflow_task<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Result<WfActivation, PollWfError>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn poll_activity_task<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Result<ActivityTask, PollActivityError>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn complete_workflow_task<'life0, 'async_trait>(
        &'life0 self,
        completion: WfActivationCompletion
    ) -> Pin<Box<dyn Future<Output = Result<(), CompleteWfError>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn complete_activity_task<'life0, 'async_trait>(
        &'life0 self,
        completion: ActivityTaskCompletion
    ) -> Pin<Box<dyn Future<Output = Result<(), CompleteActivityError>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn record_activity_heartbeat<'life0, 'async_trait>(
        &'life0 self,
        details: ActivityHeartbeat
    ) -> Pin<Box<dyn Future<Output = Result<(), ActivityHeartbeatError>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn server_gateway(&self) -> Arc<dyn ServerGatewayApis>;
#[must_use] fn shutdown<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; }

This trait is the primary way by which language specific SDKs interact with the core SDK. It is expected that only one instance of an implementation will exist for the lifetime of the worker(s) using it.

Required methods

#[must_use]
fn poll_workflow_task<'life0, 'async_trait>(
    &'life0 self
) -> Pin<Box<dyn Future<Output = Result<WfActivation, PollWfError>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Ask the core for some work, returning a WfActivation. It is then the language SDK’s responsibility to call the appropriate workflow code with the provided inputs. Blocks indefinitely until such work is available or Core::shutdown is called.

TODO: Examples

#[must_use]
fn poll_activity_task<'life0, 'async_trait>(
    &'life0 self
) -> Pin<Box<dyn Future<Output = Result<ActivityTask, PollActivityError>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Ask the core for some work, returning an ActivityTask. It is then the language SDK’s responsibility to call the appropriate activity code with the provided inputs. Blocks indefinitely until such work is available or Core::shutdown is called.

TODO: Examples

#[must_use]
fn complete_workflow_task<'life0, 'async_trait>(
    &'life0 self,
    completion: WfActivationCompletion
) -> Pin<Box<dyn Future<Output = Result<(), CompleteWfError>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Tell the core that a workflow activation has completed

#[must_use]
fn complete_activity_task<'life0, 'async_trait>(
    &'life0 self,
    completion: ActivityTaskCompletion
) -> Pin<Box<dyn Future<Output = Result<(), CompleteActivityError>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Tell the core that an activity has finished executing

#[must_use]
fn record_activity_heartbeat<'life0, 'async_trait>(
    &'life0 self,
    details: ActivityHeartbeat
) -> Pin<Box<dyn Future<Output = Result<(), ActivityHeartbeatError>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Notify workflow that activity is still alive. Long running activities that take longer than activity_heartbeat_timeout to finish must call this function in order to report progress, otherwise activity will timeout and new attempt will be scheduled. result contains latest known activity cancelation status. Note that heartbeat requests are getting batched and are sent to the server periodically, this function is going to return immediately and request will be queued in the core. Unlike java/go SDKs we are not going to return cancellation status as part of heartbeat response and instead will send it as a separate activity task to the lang, decoupling heartbeat and cancellation processing. For now activity still needs to heartbeat if it wants to receive cancellation requests. In the future we are going to change this and will dispatch cancellations more proactively.

fn server_gateway(&self) -> Arc<dyn ServerGatewayApis>[src]

Returns core’s instance of the ServerGatewayApis implementor it is using.

#[must_use]
fn shutdown<'life0, 'async_trait>(
    &'life0 self
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Initiates async shutdown procedure, eventually ceases all polling of the server. Core::poll_workflow_task should be called until it returns PollWfError::ShutDown to ensure that any workflows which are still undergoing replay have an opportunity to finish. This means that the lang sdk will need to call Core::complete_workflow_task for those workflows until they are done. At that point, the lang SDK can end the process, or drop the Core instance, which will close the connection.

Loading content...

Implementors

Loading content...