Skip to main content

ExecutableQuery

Trait ExecutableQuery 

Source
pub trait ExecutableQuery<Q: QueryDefinition>: WorkflowImplementation {
    // Required method
    fn handle(
        &self,
        ctx: &WorkflowContextView,
        input: Q::Input,
    ) -> Result<Q::Output, Box<dyn Error + Send + Sync>>;

    // Provided method
    fn dispatch(
        &self,
        ctx: &WorkflowContextView,
        input: Box<dyn Any>,
        converter: &PayloadConverter,
    ) -> Result<Payload, WorkflowError> { ... }
}
Expand description

Trait for executing query handlers on a workflow.

Required Methods§

Source

fn handle( &self, ctx: &WorkflowContextView, input: Q::Input, ) -> Result<Q::Output, Box<dyn Error + Send + Sync>>

Handle a query with the given input and return the result.

Provided Methods§

Source

fn dispatch( &self, ctx: &WorkflowContextView, input: Box<dyn Any>, converter: &PayloadConverter, ) -> Result<Payload, WorkflowError>

Dispatch the query with an already decoded input.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§