Skip to content

Commit

Permalink
Fix the mobile layout
Browse files Browse the repository at this point in the history
  • Loading branch information
gvdongen committed Jun 11, 2024
1 parent 826690d commit d9c0b20
Show file tree
Hide file tree
Showing 21 changed files with 289 additions and 341 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,27 @@ public void myOneWayCallHandler(Context ctx) {
// <start_one_way_call_java>
Client rs = Client.connect("http://localhost:8080");
GreeterServiceClient.fromClient(rs)
.send()
.greet("Hi");
// mark
.send()
.greet("Hi");

GreetCounterObjectClient.fromClient(rs, "Mary")
.send()
.greet("Hi");
// mark
.send()
.greet("Hi");
// <end_one_way_call_java>
}

public void myDelayedOneWayCallHandler(Context ctx) {
// <start_delayed_call_java>
Client rs = Client.connect("http://localhost:8080");
GreeterServiceClient.fromClient(rs)
// mark
.send(Duration.ofMillis(1000))
.greet("Hi");

GreetCounterObjectClient.fromClient(rs, "Mary")
// mark
.send(Duration.ofMillis(1000))
.greet("Hi");
// <end_delayed_call_java>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
// <start_here>
@Workflow
public class SignupWorkflow {

private static final DurablePromiseKey<String> EMAIL_CLICKED =
DurablePromiseKey.of("email_clicked", JsonSerdes.STRING);
private static final StateKey<String> STATUS =
Expand Down
76 changes: 32 additions & 44 deletions docs/concepts/durable_building_blocks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,118 +29,106 @@ Let's have a look at a handler that processes food orders:
<Tabs groupId="sdk" queryString>
<TabItem value="ts" label="TypeScript">

<CH.Spotlight start={1} className="durable-promises">
<CH.Scrollycoding className="durable-promises">
### Durable <mark class="accent">functions</mark>
Handlers take part in durable execution, meaning that Restate keeps track of their progress and recovers them to the previously reached state in case of failures.

```ts order_processor.ts
CODE_LOAD::ts/src/concepts/food_ordering.ts
```

---

```ts order_processor.ts
CODE_LOAD::ts/src/concepts/food_ordering_functions.ts
```

### Durable <mark class="accent">functions</mark>
Handlers take part in durable execution, meaning that Restate keeps track of their progress and recovers them to the previously reached state in case of failures.

---

```ts order_processor.ts
CODE_LOAD::ts/src/concepts/food_ordering_rpc.ts
```

### Durable <mark class="accent">RPCs</mark> and <mark class="accent">queues</mark>
Handlers can call other handlers in a resilient way, with or without waiting for the response.
When a failure happens, Restate handles retries and recovers partial progress.

---

```ts order_processor.ts
CODE_LOAD::ts/src/concepts/food_ordering_awakeables.ts
CODE_LOAD::ts/src/concepts/food_ordering_rpc.ts
```

---

### Durable <mark class="accent">promises and timers</mark>
Register promises in Restate to make them resilient to failures (e.g. webhooks, timers).
Restate lets the handler suspend while awaiting the promise, and invokes it again when the result is available.
A great match for function-as-a-service platforms.

---

```ts order_processor.ts
CODE_LOAD::ts/src/concepts/food_ordering_state.ts
CODE_LOAD::ts/src/concepts/food_ordering_awakeables.ts
```

---

### Consistent <mark class="accent">K/V state</mark>
Persist application state in Restate with a simple concurrency model and no extra setup. Restate makes sure state remains consistent amid failures.

---

```ts order_processor.ts
CODE_LOAD::ts/src/concepts/food_ordering_side_effect.ts
CODE_LOAD::ts/src/concepts/food_ordering_state.ts
```
---

### Journaling <mark className="accent">actions</mark>
Store the result of an action in Restate. The result gets replayed in case of failures and the action is not executed again.

</CH.Spotlight>
```ts order_processor.ts
CODE_LOAD::ts/src/concepts/food_ordering_side_effect.ts
```

</CH.Scrollycoding>
</TabItem>
<TabItem value="java" label="Java">

<CH.Spotlight start={1} className="durable-promises">
<CH.Scrollycoding className="durable-promises">

```java OrderWorkflow.java
CODE_LOAD::java/src/main/java/concepts/buildingblocks/part0/OrderWorkflow.java
```
### Durable <mark className="accent">functions</mark>
Handlers take part in durable execution, meaning that Restate keeps track of their progress and recovers them to the previously reached state in case of failures.

---

```java OrderWorkflow.java
CODE_LOAD::java/src/main/java/concepts/buildingblocks/part1_functions/OrderWorkflow.java
```

### Durable <mark className="accent">functions</mark>
Handlers take part in durable execution, meaning that Restate keeps track of their progress and recovers them to the previously reached state in case of failures.

---

```java OrderWorkflow.java
CODE_LOAD::java/src/main/java/concepts/buildingblocks/part2_rpc/OrderWorkflow.java
```

### Durable <mark className="accent">RPCs</mark> and <mark className="accent">queues</mark>
Handlers can call other handlers in a resilient way, with or without waiting for the response.
When a failure happens, Restate handles retries and recovers partial progress.

---

```java OrderWorkflow.java
CODE_LOAD::java/src/main/java/concepts/buildingblocks/part3_promises/OrderWorkflow.java
CODE_LOAD::java/src/main/java/concepts/buildingblocks/part2_rpc/OrderWorkflow.java
```

---

### Durable <mark className="accent">promises and timers</mark>
Register promises in Restate to make them resilient to failures (e.g. webhooks, timers). Restate lets the handler suspend while awaiting the promise, and invokes it again when the result is available. A great match for function-as-a-service platforms.

---

```java OrderWorkflow.java
CODE_LOAD::java/src/main/java/concepts/buildingblocks/part4_state/OrderWorkflow.java
CODE_LOAD::java/src/main/java/concepts/buildingblocks/part3_promises/OrderWorkflow.java
```

---

### Consistent <mark className="accent">K/V state</mark>
Persist application state in Restate with a simple concurrency model and no extra setup. Restate makes sure state remains consistent amid failures.

---

```java OrderWorkflow.java
CODE_LOAD::java/src/main/java/concepts/buildingblocks/part5_sideeffects/OrderWorkflow.java
CODE_LOAD::java/src/main/java/concepts/buildingblocks/part4_state/OrderWorkflow.java
```

---

### Journaling <mark className="accent">actions</mark>
Store the result of an action in Restate. The result gets replayed in case of failures and the function is not executed again.

```java OrderWorkflow.java
CODE_LOAD::java/src/main/java/concepts/buildingblocks/part5_sideeffects/OrderWorkflow.java
```

</CH.Spotlight>
</CH.Scrollycoding>
</TabItem>
</Tabs>

54 changes: 23 additions & 31 deletions docs/concepts/invocations.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ Invocations get a unique identifier. This identifier is used to track the progre

<Tabs groupId="sdk" queryString>
<TabItem value="ts" label="TypeScript">
<CH.Spotlight start={1} className="durable-promises">
<CH.Scrollycoding start={1} className="durable-promises">

**<mark className="accent">Request-response</mark> invocations** allow you to wait on a response from the handler.

<CH.Code rows={20}>

Expand All @@ -75,9 +76,8 @@ Invocations get a unique identifier. This identifier is used to track the progre

---

**<mark class="accent">Request-response</mark> invocations** allow you to wait on a response from the handler.

---
**<mark className="accent">One-way</mark> invocations** allow you to trigger an asynchronous action.
This returns an invocation ID with which you can retrieve the result of the invocation later, if desired.

<CH.Code rows={20}>

Expand All @@ -91,11 +91,10 @@ Invocations get a unique identifier. This identifier is used to track the progre

</CH.Code>

**<mark class="accent">One-way</mark> invocations** allow you to trigger an asynchronous action.
This returns an invocation ID with which you can retrieve the result of the invocation later, if desired.

---

**<mark className="accent">Delayed</mark> invocations** allow you to schedule an invocation for a later point in time.

<CH.Code rows={20}>

```typescript restate_service.ts
Expand All @@ -108,13 +107,13 @@ Invocations get a unique identifier. This identifier is used to track the progre

</CH.Code>

**<mark class="accent">Delayed</mark> invocations** allow you to schedule an invocation for a later point in time.

</CH.Spotlight>
</CH.Scrollycoding>
</TabItem>
<TabItem value="java" label="Java">

<CH.Spotlight start={1} className="durable-promises">
<CH.Scrollycoding className="durable-promises">

**<mark className="accent">Request-response</mark> invocations** allow you to wait on a response from the handler.

<CH.Code rows={20}>

Expand All @@ -130,9 +129,8 @@ Invocations get a unique identifier. This identifier is used to track the progre

---

**<mark class="accent">Request-response</mark> invocations** allow you to wait on a response from the handler.

---
**<mark className="accent">One-way</mark> invocations** allow you to trigger an asynchronous action.
This returns an invocation ID with which you can retrieve the result of the invocation later, if desired.

<CH.Code rows={20}>

Expand All @@ -147,11 +145,10 @@ Invocations get a unique identifier. This identifier is used to track the progre

</CH.Code>

**<mark class="accent">One-way</mark> invocations** allow you to trigger an asynchronous action.
This returns an invocation ID with which you can retrieve the result of the invocation later, if desired.

---

**<mark className="accent">Delayed</mark> invocations** allow you to schedule an invocation for a later point in time.

<CH.Code rows={20}>

```java RestateService.java
Expand All @@ -164,15 +161,15 @@ Invocations get a unique identifier. This identifier is used to track the progre

</CH.Code>

**<mark class="accent">Delayed</mark> invocations** allow you to schedule an invocation for a later point in time.

</CH.Spotlight>
</CH.Scrollycoding>


</TabItem>
<TabItem value="shell" label="Shell">

<CH.Spotlight start={1} className="durable-promises">
<CH.Scrollycoding start={1} className="durable-promises">

**<mark className="accent">Request-response</mark> invocations** allow you to wait on a response from the handler.

```bash
curl localhost:8080/GreeterService/greet \
Expand All @@ -190,9 +187,8 @@ Invocations get a unique identifier. This identifier is used to track the progre

---

**<mark class="accent">Request-response</mark> invocations** allow you to wait on a response from the handler.

---
**<mark className="accent">One-way</mark> invocations** allow you to trigger an asynchronous action.
This returns an invocation ID with which you can retrieve the result of the invocation later, if desired.

```bash
curl localhost:8080/GreeterService/greet/send \
Expand All @@ -208,11 +204,10 @@ Invocations get a unique identifier. This identifier is used to track the progre
-d '"Hi"'
```

**<mark class="accent">One-way</mark> invocations** allow you to trigger an asynchronous action.
This returns an invocation ID with which you can retrieve the result of the invocation later, if desired.

---

**<mark className="accent">Delayed</mark> invocations** allow you to schedule an invocation for a later point in time.

```bash
curl localhost:8080/GreeterService/greet/send?delay=10s \
-H 'content-type: application/json' \
Expand All @@ -223,10 +218,7 @@ Invocations get a unique identifier. This identifier is used to track the progre
-d '"Hi"'
```

**<mark class="accent">Delayed</mark> invocations** allow you to schedule an invocation for a later point in time.


</CH.Spotlight>
</CH.Scrollycoding>
</TabItem>
</Tabs>

Expand Down
Loading

0 comments on commit d9c0b20

Please sign in to comment.