|
79 | 79 | //! - The service handler can now be called at `<RESTATE_INGRESS_URL>/MyService/myHandler`. You can optionally override the handler name used via `#[name = "myHandler"]`. More details on handler invocations can be found in the [docs](https://docs.restate.dev/invoke/http). |
80 | 80 | //! - Implement the trait on a concrete type, for example on a struct. |
81 | 81 | //! - The first parameter of a handler after `&self` is always a [`Context`](crate::context::Context) to interact with Restate. |
82 | | -//! The SDK stores the actions you do on the context in the Restate journal to make them durable. |
| 82 | +//! The SDK stores the actions you do on the context in the Restate journal to make them durable. |
83 | 83 | //! - Finally, create an HTTP endpoint and bind the service(s) to it. Listen on the specified port (here 9080) for connections and requests. |
84 | 84 | //! |
85 | 85 | //! ## Virtual Objects |
|
133 | 133 | //! - The first argument of each handler must be the [`ObjectContext`](crate::context::ObjectContext) parameter. Handlers with the `ObjectContext` parameter can write to the K/V state store. Only one handler can be active at a time per object, to ensure consistency. |
134 | 134 | //! - You can retrieve the key of the object you are in via [`ObjectContext.key`]. |
135 | 135 | //! - If you want to have a handler that executes concurrently to the others and doesn't have write access to the K/V state, add `#[shared]` to the handler definition in the trait. |
136 | | -//! Shared handlers need to use the [`SharedObjectContext`](crate::context::SharedObjectContext). |
137 | | -//! You can use these handlers, for example, to read K/V state and expose it to the outside world, or to interact with the blocking handler and resolve awakeables etc. |
| 136 | +//! Shared handlers need to use the [`SharedObjectContext`](crate::context::SharedObjectContext). |
| 137 | +//! You can use these handlers, for example, to read K/V state and expose it to the outside world, or to interact with the blocking handler and resolve awakeables etc. |
138 | 138 | //! |
139 | 139 | //! ## Workflows |
140 | 140 | //! |
|
180 | 180 | //! - Specify that you want to create a Workflow by using the [`#[restate_sdk::workflow]` macro](workflow). |
181 | 181 | //! - The workflow needs to have a `run` handler. |
182 | 182 | //! - The first argument of the `run` handler must be the [`WorkflowContext`](crate::context::WorkflowContext) parameter. |
183 | | -//! The `WorkflowContext` parameter is used to interact with Restate. |
184 | | -//! The `run` handler executes exactly once per workflow instance. |
| 183 | +//! The `WorkflowContext` parameter is used to interact with Restate. |
| 184 | +//! The `run` handler executes exactly once per workflow instance. |
185 | 185 | //! - The other handlers of the workflow are used to interact with the workflow: either query it, or signal it. |
186 | | -//! They use the [`SharedWorkflowContext`](crate::context::SharedWorkflowContext) to interact with the SDK. |
187 | | -//! These handlers can run concurrently with the run handler and can still be called after the run handler has finished. |
| 186 | +//! They use the [`SharedWorkflowContext`](crate::context::SharedWorkflowContext) to interact with the SDK. |
| 187 | +//! These handlers can run concurrently with the run handler and can still be called after the run handler has finished. |
188 | 188 | //! - Have a look at the [workflow docs](workflow) to learn more. |
189 | 189 | //! |
190 | 190 | //! |
@@ -454,7 +454,7 @@ pub use restate_sdk_macros::object; |
454 | 454 | /// Do the following: |
455 | 455 | /// 1. Create a promise that is durable and distributed in the `run` handler, and wait for its completion. In the example, we wait on the promise `email.clicked`. |
456 | 456 | /// 2. Resolve or reject the promise in another handler in the workflow. This can be done at most one time. |
457 | | -/// In the example, the `click` handler gets called when the user clicks a link in an email and resolves the `email.clicked` promise. |
| 457 | +/// In the example, the `click` handler gets called when the user clicks a link in an email and resolves the `email.clicked` promise. |
458 | 458 | /// |
459 | 459 | /// You can also use this pattern in reverse and let the `run` handler resolve promises that other handlers are waiting on. |
460 | 460 | /// For example, the `run` handler could resolve a promise when it finishes a step of the workflow, so that other handlers can request whether this step has been completed. |
|
0 commit comments