You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/lib.rs
+17-9
Original file line number
Diff line number
Diff line change
@@ -349,18 +349,26 @@ pub use restate_sdk_macros::object;
349
349
///
350
350
/// Entry-point macro to define a Restate [Workflow](https://docs.restate.dev/concepts/services#workflows).
351
351
///
352
-
/// Workflows are a sequence of steps that gets executed durably.
353
-
/// A workflow can be seen as a special type of [Virtual Object](https://docs.restate.dev/concepts/services#virtual-objects) with some special characteristics:
354
-
///
355
-
/// - Each workflow definition has a `run` handler that implements the workflow logic.
356
-
/// - The `run` handler executes exactly one time for each workflow instance (object / key).
357
-
/// - A workflow definition can implement other handlers that can be called multiple times, and can interact with the workflow.
358
-
/// - Workflows have access to the `WorkflowContext` and `SharedWorkflowContext`, giving them some extra functionality, for example Durable Promises to signal workflows.
352
+
/// [Workflows](https://docs.restate.dev/concepts/services#workflows) are a sequence of steps that gets executed durably.
353
+
///
354
+
/// A workflow can be seen as a special type of [Virtual Object](https://docs.restate.dev/concepts/services#virtual-objects) with the following characteristics:
355
+
///
356
+
/// - Each workflow definition has a **`run` handler** that implements the workflow logic.
357
+
/// - The `run` handler **executes exactly one time** for each workflow instance (object / key).
358
+
/// - The `run` handler executes a set of **durable steps/activities**. These can either be:
359
+
/// - Inline activities: for example a [run block](crate::context::ContextSideEffects) or [sleep](crate::context::ContextTimers)
360
+
/// - [Calls to other handlers](crate::context::ContextClient) implementing the activities
361
+
/// - You can **submit a workflow** in the same way as any handler invocation (via SDK clients or Restate services, over HTTP or Kafka).
362
+
/// - A workflow definition can implement other handlers that can be called multiple times, and can **interact with the workflow**:
363
+
/// - Query the workflow (get information out of it) by getting K/V state or awaiting promises that are resolved by the workflow.
364
+
/// - Signal the workflow (send information to it) by resolving promises that the workflow waits on.
365
+
/// - Workflows have access to the [`WorkflowContext`](crate::context::WorkflowContext) and [`SharedWorkflowContext`](crate::context::SharedWorkflowContext), giving them some extra functionality, for example [Durable Promises](#signaling-workflows) to signal workflows.
366
+
/// - The K/V state of the workflow is isolated to the workflow execution, and can only be mutated by the `run` handler.
359
367
///
360
368
/// **Note: Workflow retention time**:
361
369
/// The retention time of a workflow execution is 24 hours after the finishing of the `run` handler.
362
370
/// After this timeout any [K/V state][crate::context::ContextReadState] is cleared, the workflow's shared handlers cannot be called anymore, and the Durable Promises are discarded.
363
-
/// The retention time can be configured via the [Admin API](https://docs.restate.dev//references/admin-api/#tag/service/operation/modify_service) per Workflow definition by setting `workflow_completion_retention`.
371
+
/// The retention time can be configured via the [Admin API](https://docs.restate.dev/references/admin-api/#tag/service/operation/modify_service) per Workflow definition by setting `workflow_completion_retention`.
364
372
///
365
373
/// ## Implementing workflows
366
374
/// Have a look at the code example to get a better understanding of how workflows are implemented:
@@ -419,7 +427,7 @@ pub use restate_sdk_macros::object;
419
427
/// Every workflow needs a `run` handler.
420
428
/// This handler has access to the same SDK features as Service and Virtual Object handlers.
421
429
/// In the example above, we use [`ctx.run`][crate::context::ContextSideEffects::run] to log the sending of the email in Restate and avoid re-execution on replay.
0 commit comments