Skip to content

Commit afc40ce

Browse files
committed
Improve Typescript pattern readme
1 parent 97a6b8f commit afc40ce

File tree

1 file changed

+28
-16
lines changed

1 file changed

+28
-16
lines changed

typescript/patterns-use-cases/README.md

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,34 @@
22

33
Common tasks and patterns implemented with Restate:
44

5-
| Use case / Pattern | | | Difficulty | Description |
6-
|--------------------------------------------------------|---------------------------------------------------------|--------------------------------------------------------------------------------------------------------|--------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
7-
| Durable RPC, Idempotency and Concurrency | [code](src/durablerpc/express_app.ts) | [README](README.md#durable-rpc-idempotency-and-concurrency) | Basic | Use the programmatic clients to invoke Restate handlers. Add idempotency keys for deduplication. And limit concurrency via Virtual Objects. |
8-
| (Delayed) Message Queue | [code](src/queue/task_submitter.ts) | [README](README.md#delayed-message-queue) | Basic | Use Restate as a queue. Send a (delayed) event to a handler. Optionally, retrieve the response later. |
9-
| Sagas | [code](src/sagas/booking_workflow.ts) | [README](README.md#sagas) | Basic | Preserve consistency by tracking undo actions and running them when code fails halfway through. Restate guarantees completion. |
10-
| Webhook Event Processing | [code](src/webhookcallbacks/webhook_callback_router.ts) | [README](#durable-webhook-event-processing) | Basic | Point webhook callbacks to a Restate handler for durable event processing. |
11-
| Scheduling Tasks | [code](src/schedulingtasks/payment_reminders.ts) | [README](#scheduling-tasks-and-durable-webhooks) | Basic | Use Restate as scheduler. Schedule tasks for later and ensure the task is triggered and executed. |
12-
| Stateful Actors and Durable State Machines | [code](src/statefulactors/machine_operator.ts) | [README](README.md#stateful-actors-and-durable-state-machines) | Basic | Stateful Actor representing a machine in our factory. The handlers bring the machine up and down and track the state transitions, built as a Restate Virtual Object for automatic state persistence. |
13-
| Event processing: Transactional handlers | [code](src/eventtransactions/user_feed.ts) | [README](README.md#event-processing-transactional-handlers-with-durable-side-effects-and-timers) | Basic | Processing events (from Kafka) to update various downstream systems in a transactional way. With durable side effects and timers. |
14-
| Event processing: Enriching streams | [code](src/eventenrichment/package_tracker.ts) | [README](README.md#event-processing-event-enrichment) | Basic | Stateful functions/actors connected to Kafka and callable over RPC. |
15-
| Parallelizing work | [code](src/parallelizework/fan_out_worker.ts) | [README](README.md#parallelizing-work) | Intermediate | Execute a list of tasks in parallel and then gather their result. |
16-
| Turn slow sync tasks into async | [code](src/dataupload/client.ts) | [README](README.md#async-data-upload) | Intermediate | Kick of a synchronous task (e.g. data upload) and turn it into an asynchronous one if it takes too long. |
17-
| Payment state machines | [code](src/statemachinepayments/payment_service.ts) | [README](README.md#payment-state-machine) | Advanced | State machine example that tracks a payment process, ensuring consistent processing and cancellations. |
18-
| Payments: combining sync responses and async callbacks | [code](src/signalspayments/payment_service.ts) | [README](README.md#payment-signals---combining-sync-responses-and-async-webhook-callbacks-from-stripe) | Advanced | Handling async payment callbacks for slow payments, with Stripe. |
19-
| Patterns: Durable Promises | [code](durablepromise) | [README](README.md#pattern-durable-promises) | Advanced | Custom implementation of Promises/Futures that are durable across processes and failures. |
20-
| Patterns: Priority Queue | [code](priorityqueue) | [README](README.md#pattern-priority-queue) | Advanced | Example of implementing a priority queue to manage task execution order. |
5+
**Basics:**
6+
7+
| Use case / Pattern | Code | README | Description |
8+
|------------------------------------------|--------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
9+
| Durable RPC, Idempotency and Concurrency | [code](src/durablerpc/express_app.ts) | [README](README.md#durable-rpc-idempotency-and-concurrency) | Use the programmatic clients to call Restate handlers. Add idempotency keys for deduplication. |
10+
| (Delayed) Message Queue | [code](src/queue/task_submitter.ts) | [README](README.md#delayed-message-queue) | Use Restate as a queue. Send a (delayed) event to a handler. Optionally, retrieve the response later. |
11+
| Sagas | [code](src/sagas/booking_workflow.ts) | [README](README.md#sagas) | Preserve consistency by tracking undo actions and running them when code fails halfway through. Restate guarantees completion. |
12+
| Webhook Event Processing | [code](src/webhookcallbacks/webhook_callback_router.ts) | [README](#durable-webhook-event-processing) | Point webhook callbacks to a Restate handler for durable event processing. |
13+
| Scheduling Tasks | [code](src/schedulingtasks/payment_reminders.ts) | [README](#scheduling-tasks-and-durable-webhooks) | Use Restate as scheduler. Schedule tasks for later and ensure the task is triggered and executed. |
14+
| Stateful Actors and State Machines | [code](src/statefulactors/machine_operator.ts) | [README](README.md#stateful-actors-and-durable-state-machines) | Stateful Actor representing a machine in our factory. The handlers bring the machine up and down and track the state transitions, built as a Restate Virtual Object for automatic state persistence. |
15+
| Event processing: Transactional handlers | [code](src/eventtransactions/user_feed.ts) | [README](README.md#event-processing-transactional-handlers-with-durable-side-effects-and-timers) | Processing events (from Kafka) to update various downstream systems in a transactional way. With durable side effects and timers. |
16+
| Event processing: Enriching streams | [code](src/eventenrichment/package_tracker.ts) | [README](README.md#event-processing-event-enrichment) | Stateful functions/actors connected to Kafka and callable over RPC. |
17+
18+
**Intermediate:**
19+
20+
| Use case / Pattern | | | Description |
21+
|--------------------------------------------------------|---------------------------------------------------------|--------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
22+
| Parallelizing work | [code](src/parallelizework/fan_out_worker.ts) | [README](README.md#parallelizing-work) | Execute a list of tasks in parallel and then gather their result. |
23+
| Turn slow sync tasks into async | [code](src/dataupload/client.ts) | [README](README.md#async-data-upload) | Kick of a synchronous task (e.g. data upload) and turn it into an asynchronous one if it takes too long. |
24+
25+
**Advanced:**
26+
27+
| Use case / Pattern | | | Description |
28+
|--------------------------------------------------------|---------------------------------------------------------|--------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
29+
| Payment state machines | [code](src/statemachinepayments/payment_service.ts) | [README](README.md#payment-state-machine) | State machine example that tracks a payment process, ensuring consistent processing and cancellations. |
30+
| Payments: combining sync responses and async callbacks | [code](src/signalspayments/payment_service.ts) | [README](README.md#payment-signals---combining-sync-responses-and-async-webhook-callbacks-from-stripe) | Handling async payment callbacks for slow payments, with Stripe. |
31+
| Patterns: Durable Promises | [code](durablepromise) | [README](README.md#pattern-durable-promises) | Custom implementation of Promises/Futures that are durable across processes and failures. |
32+
| Patterns: Priority Queue | [code](priorityqueue) | [README](README.md#pattern-priority-queue) | Example of implementing a priority queue to manage task execution order. |
2133

2234
First, install the dependencies:
2335

0 commit comments

Comments
 (0)