Skip to content

Commit d2ec402

Browse files
Fix counter example, and related readme
1 parent 6ef32e7 commit d2ec402

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

examples/README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ For a sample project configuration and more elaborated examples, check out the [
66

77
Available examples:
88

9-
* [`Counter`](src/main/java/dev/restate/sdk/examples/Counter.java): Shows a simple virtual object using state primitives.
10-
* [`VanillaGrpcCounter`](src/main/java/dev/restate/sdk/examples/VanillaGrpcCounter.java): Same as `Counter` but using the vanilla gRPC code generator output.
9+
* [`Counter`](src/main/java/my/restate/sdk/examples/Counter.java): Shows a simple virtual object using state primitives.
1110
* [`CounterKt`](src/main/kotlin/dev/restate/sdk/examples/CounterKt.kt): Same as `Counter` but using Kotlin.
11+
* [`LoanWorkflow`](src/main/java/my/restate/sdk/examples/LoanWorkflow.java): Shows a simple workflow example using the Workflow API.
1212

1313
## Package the examples for Lambda
1414

@@ -22,11 +22,11 @@ You'll find the shadowed jar in the `build` directory.
2222

2323
The class to configure in Lambda is `my.restate.sdk.examples.LambdaHandler`.
2424

25-
By default, the [`dev.restate.sdk.examples.Counter`](src/main/java/dev/restate/sdk/examples/Counter.java) bindableComponent is deployed. Set the env variable `LAMBDA_FACTORY_SERVICE_CLASS` to one of the available example classes to change the deployed class.
25+
By default, the [`my.restate.sdk.examples.Counter`](src/main/java/my/restate/sdk/examples/Counter.java) virtual object is deployed. Set the env variable `LAMBDA_FACTORY_SERVICE_CLASS` to one of the available example classes to change the deployed class.
2626

2727
## Running the examples (HTTP)
2828

29-
You can run the Java counter bindableComponent via:
29+
You can run the Java Counter example via:
3030

3131
```shell
3232
./gradlew :examples:run
@@ -40,10 +40,13 @@ You can modify the class to run setting `-PmainClass=<FQCN>`, for example, in or
4040

4141
## Invoking the counter bindableComponent
4242

43-
If you want to invoke the counter bindableComponent via [grpcurl](https://github.com/fullstorydev/grpcurl):
43+
If you want to invoke the counter virtual object via curl:
4444

4545
```shell
46-
grpcurl -plaintext -d '{"counter_name": "my_counter"}' localhost:9090 counter.Counter/Get
46+
# To add a new value to my-counter
47+
curl http://localhost:8080/Counter/my-counter/add --json "1"
48+
# To get my-counter value
49+
curl http://localhost:8080/Counter/my-counter/get
4750
```
4851

49-
The command assumes that the Restate runtime is reachable under `localhost:9090`.
52+
The command assumes that the Restate runtime is reachable under `localhost:8080`.

examples/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ dependencies {
3232

3333
application {
3434
val mainClassValue: String =
35-
project.findProperty("mainClass")?.toString() ?: "dev.restate.sdk.examples.Counter"
35+
project.findProperty("mainClass")?.toString() ?: "my.restate.sdk.examples.Counter"
3636
mainClass.set(mainClassValue)
3737
}

examples/src/main/java/my/restate/sdk/examples/Counter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import org.apache.logging.log4j.LogManager;
1818
import org.apache.logging.log4j.Logger;
1919

20-
@VirtualObject
20+
@VirtualObject(name = "Counter")
2121
public class Counter {
2222

2323
private static final Logger LOG = LogManager.getLogger(Counter.class);

0 commit comments

Comments
 (0)