#[workflow_methods]Expand description
Defines workflow methods for a workflow struct. Using this macro requires that
you also depend on the temporalio_sdk crate.
This macro processes an impl block and generates:
- Marker structs for each workflow method
- Trait implementations for workflow definition and execution
- Registration code for workers
§Macro Attributes
factory_only- When set, the workflow must be registered usingregister_workflow_with_factoryand does not need to implementDefaultor define an#[init]method. Ex:#[workflow_methods(factory_only)]
§Method Attributes
#[init]- Optional initialization method. Signature:fn new(input: T, ctx: &WorkflowContext) -> Self#[run]- Required main workflow function. Signature:async fn run(&mut self, ctx: &mut WorkflowContext) -> WorkflowResult<T>#[signal]- Signal handler. Sync:fn signal(&mut self, ctx: &mut SyncWorkflowContext, input: T). Async:async fn signal(ctx: &mut WorkflowContext, input: T)#[query]- Query handler. Signature:fn query(&self, ctx: &WorkflowContextView, input: T) -> R(must NOT be async)#[update]- Update handler. Sync:fn update(&mut self, ctx: &mut SyncWorkflowContext, input: T) -> R. Async:async fn update(ctx: &mut WorkflowContext, input: T) -> R
For a usage example, see the temporalio_sdk crate’s documentation.