pub struct QueryService<H: ?Sized> { /* private fields */ }Expand description
Non-recording, non-disruptive live workflow query dispatcher.
QueryService depends only on the engine seam’s residency and mailbox-delivery operations. It
has no durable history dependency and no persistence method, so query dispatch is structurally a
read-only interaction. The delivered WorkflowMailboxMessage::Query is a distinct message
kind carrying a one-shot reply channel; AE/workflow processes answer it at deterministic yield
points from registered read-only handlers so in-progress workflow steps are not preempted or
mutated.
Implementations§
Source§impl<H> QueryService<H>where
H: EngineHandle + ?Sized,
impl<H> QueryService<H>where
H: EngineHandle + ?Sized,
Sourcepub fn new(engine: Arc<H>, query_timeout: Duration) -> Self
pub fn new(engine: Arc<H>, query_timeout: Duration) -> Self
Creates a query service with an engine-configured timeout.
Sourcepub async fn query(
&self,
workflow_id: &WorkflowId,
name: impl Into<String>,
args: Payload,
) -> QueryServiceResult
pub async fn query( &self, workflow_id: &WorkflowId, name: impl Into<String>, args: Payload, ) -> QueryServiceResult
Dispatches a read-only query to a resident workflow and returns the handler reply payload.
§Errors
Returns QueryError::Unknown for unknown workflows, QueryError::NotRunning for
terminal or non-resident workflows, QueryError::Timeout when no handler reply arrives
before the configured timeout, QueryError::UnknownQuery when the workflow replies that
no handler exists, and QueryError::Engine for seam failures.
Sourcepub async fn query_process(
&self,
process: WorkflowProcessHandle,
name: impl Into<String>,
args: Payload,
) -> QueryServiceResult
pub async fn query_process( &self, process: WorkflowProcessHandle, name: impl Into<String>, args: Payload, ) -> QueryServiceResult
Dispatches a read-only query to an already-resolved workflow process.
Run-exact variant of Self::query for callers that resolved the
target handle themselves (the engine seam resolves (workflow, run)
before delegation, so re-resolving by workflow id here would race
continue-as-new and multi-run histories).
§Errors
Returns QueryError::Timeout when no handler reply arrives before the configured
timeout, QueryError::UnknownQuery when the workflow replies that no handler exists,
QueryError::HandlerFailed when the handler ran and reported failure,
QueryError::ReplyDropped when the workflow ended before answering, and
QueryError::Engine for seam failures.
Sourcepub const fn query_timeout(&self) -> Duration
pub const fn query_timeout(&self) -> Duration
Returns the engine-configured timeout used for query replies.