Skip to content

Commit dae9f59

Browse files
committed
Add Show code buttons to TS readme
1 parent 4e12a03 commit dae9f59

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

typescript/patterns-use-cases/README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ First, install the dependencies:
3232
npm install
3333
```
3434

35-
## Durable RPC, Idempotency and Concurrency
35+
## Durable RPC, Idempotency and Concurrency
36+
[<img src="https://raw.githubusercontent.com/restatedev/img/refs/heads/main/show-code.svg">](src/durablerpc/express_app.ts)
3637

3738
This example shows:
3839
- **Durable RPC**: once a request has reached Restate, it is guaranteed to be processed
@@ -73,6 +74,7 @@ Restate deduplicated the request (with the reservation ID as idempotency key) an
7374
</details>
7475

7576
## (Delayed) Message Queue
77+
[<img src="https://raw.githubusercontent.com/restatedev/img/refs/heads/main/show-code.svg">](src/queue/task_submitter.ts)
7678

7779
Use Restate as a queue. Schedule tasks for now or later and ensure the task is only executed once.
7880

@@ -83,6 +85,7 @@ Use Restate as a queue. Schedule tasks for now or later and ensure the task is o
8385
- [Async Task Worker](src/queue/async_task_worker.ts): gets invoked by Restate for each task in the queue.
8486

8587
## Webhook Callbacks
88+
[<img src="https://raw.githubusercontent.com/restatedev/img/refs/heads/main/show-code.svg">](src/webhookcallbacks/webhook_callback_router.ts)
8689

8790
This example processes webhook callbacks from a payment provider.
8891

@@ -92,6 +95,7 @@ This turns handlers into durable event processors that ensure the event is proce
9295
You don't need to do anything special!
9396

9497
## Convert Sync Tasks to Async
98+
[<img src="https://raw.githubusercontent.com/restatedev/img/refs/heads/main/show-code.svg">](src/webhookcallbacks/webhook_callback_router.ts)
9599

96100
This example shows how to use the Restate SDK to **kick of a synchronous task and turn it into an asynchronous one if it takes too long**.
97101

@@ -118,6 +122,7 @@ Have a look at the logs to see how the execution switches from synchronously wai
118122
</details>
119123

120124
## Payment Signals
125+
[<img src="https://raw.githubusercontent.com/restatedev/img/refs/heads/main/show-code.svg">](src/signalspayments/payment_service.ts)
121126

122127
This example issues a payment request to Stripe.
123128
When calling Stripe, the result often comes synchronously as a response API call.
@@ -189,6 +194,7 @@ A few notes:
189194
</details>
190195

191196
## Sagas
197+
[<img src="https://raw.githubusercontent.com/restatedev/img/refs/heads/main/show-code.svg">](src/sagas/booking_workflow.ts)
192198

193199
An example of a trip reservation workflow, using the saga pattern to undo previous steps in case of an error.
194200

@@ -251,6 +257,7 @@ Flight 51e219f8-eb34-4384-a5ff-88607e89c220 cancelled
251257
</details>
252258

253259
## Stateful Actors and State Machines
260+
[<img src="https://raw.githubusercontent.com/restatedev/img/refs/heads/main/show-code.svg">](src/statefulactors/machine_operator.ts)
254261

255262
This example implements a State Machine with a Virtual Object.
256263

@@ -326,6 +333,7 @@ A failure happened!
326333
</details>
327334

328335
## Payment State Machines
336+
[<img src="https://raw.githubusercontent.com/restatedev/img/refs/heads/main/show-code.svg">](src/statemachinepayments/payment_service.ts)
329337

330338
This example shows how to build a reliable payment state machine.
331339

@@ -399,6 +407,8 @@ status "CANCELLED"
399407
</details>
400408

401409
## Scheduling Tasks
410+
[<img src="https://raw.githubusercontent.com/restatedev/img/refs/heads/main/show-code.svg">](src/schedulingtasks/payment_reminders.ts)
411+
402412
This example processes failed payment events from a payment provider.
403413
The service reminds the customer for 3 days to update their payment details, and otherwise escalates to support.
404414

@@ -408,6 +418,7 @@ The handler calls itself three times in a row after a delay of one day, and then
408418
Restate tracks the timer across failures, and triggers execution.
409419

410420
## Parallelizing work
421+
[<img src="https://raw.githubusercontent.com/restatedev/img/refs/heads/main/show-code.svg">](src/parallelizework/fan_out_worker.ts)
411422

412423
This example shows how to use the Restate SDK to **execute a list of tasks in parallel and then gather their result**.
413424
Also known as fan-out, fan-in.
@@ -419,6 +430,7 @@ Restate guarantees and manages the execution of all the subtasks across failures
419430
You can run this on FaaS infrastructure, like AWS Lambda, and it will scale automatically.
420431

421432
## Transactional Event Processing
433+
[<img src="https://raw.githubusercontent.com/restatedev/img/refs/heads/main/show-code.svg">](src/eventtransactions/user_feed.ts)
422434

423435
Processing events (from Kafka) to update various downstream systems.
424436
- Durable side effects with retries and recovery of partial progress
@@ -493,6 +505,7 @@ You can try it out by killing Restate or the service halfway through processing
493505
</details>
494506
495507
## Event Enrichment / Joins
508+
[<img src="https://raw.githubusercontent.com/restatedev/img/refs/heads/main/show-code.svg">](src/eventenrichment/package_tracker.ts)
496509
497510
This example shows an example of:
498511
- **Event enrichment** over different sources: RPC and Kafka
@@ -576,6 +589,7 @@ You can see how the state was enriched by the initial RPC event and the subseque
576589
</details>
577590
578591
## Durable Promises
592+
[<img src="https://raw.githubusercontent.com/restatedev/img/refs/heads/main/show-code.svg">](src/durablepromise)
579593
580594
The Durable Promises implemented in this example work like regular futures/promises,
581595
but are durable cross processes and failures.
@@ -666,6 +680,7 @@ optionally passing `[promise-id] [restateUri]` as parameters.
666680
</details>
667681
668682
## Priority queue
683+
[<img src="https://raw.githubusercontent.com/restatedev/img/refs/heads/main/show-code.svg">](src/priorityqueue)
669684
670685
An example of implementing your own priority queue using Restate state and awakeables.
671686

0 commit comments

Comments
 (0)