-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move Tour of Restate Java to examples (#93)
* Add Java Tour of Restate * Add to git workflows * Add to zip creation
- Loading branch information
Showing
38 changed files
with
1,533 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.gradle | ||
.idea | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# A Tour of Restate with Java | ||
|
||
Restate is a system for easily building resilient applications using **distributed durable RPC & async/await**. | ||
|
||
This example contains the code for the `Tour of Restate` tutorial, for the Java SDK. | ||
This tutorial takes your through key Restate features by developing an end-to-end ticketing app. | ||
|
||
❓ Learn more about Restate from the [Restate documentation](https://docs.restate.dev). | ||
|
||
|
||
## Download the example | ||
|
||
- Via the CLI: | ||
```shell | ||
restate example java-tour-of-restate && cd java-tour-of-restate | ||
``` | ||
|
||
- Via git clone: | ||
```shell | ||
git clone git@github.com:restatedev/examples.git | ||
cd examples/java/tour-of-restate | ||
``` | ||
|
||
- Via `wget`: | ||
```shell | ||
wget https://github.com/restatedev/examples/releases/latest/download/java-tour-of-restate.zip && unzip java-tour-of-restate.zip -d java-tour-of-restate && rm java-tour-of-restate.zip | ||
``` | ||
|
||
## Running the example | ||
|
||
Have a look at the [Tour of Restate tutorial](https://docs.restate.dev/tour) in the documentation to build and run the application in this repository. | ||
|
||
In short, you can run the different parts of the code via: | ||
|
||
```typescript | ||
./gradlew run | ||
./gradlew -PmainClass=dev.restate.tour.part1.AppMain run | ||
./gradlew -PmainClass=dev.restate.tour.part2.AppMain run | ||
./gradlew -PmainClass=dev.restate.tour.part3.AppMain run | ||
./gradlew -PmainClass=dev.restate.tour.part4.AppMain run | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import com.google.protobuf.gradle.id | ||
|
||
plugins { | ||
java | ||
application | ||
|
||
id("com.google.protobuf") version "0.9.1" | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
val restateSdkVersion = "0.7.0" | ||
|
||
dependencies { | ||
// Restate SDK | ||
implementation("dev.restate:sdk-api:$restateSdkVersion") | ||
implementation("dev.restate:sdk-http-vertx:$restateSdkVersion") | ||
// To use Jackson to read/write state entries (optional) | ||
implementation("dev.restate:sdk-serde-jackson:$restateSdkVersion") | ||
|
||
// Protobuf and grpc dependencies | ||
implementation("com.google.protobuf:protobuf-java:3.24.3") | ||
implementation("io.grpc:grpc-stub:1.58.0") | ||
implementation("io.grpc:grpc-protobuf:1.58.0") | ||
// This is needed to compile the @Generated annotation forced by the grpc compiler | ||
// See https://github.com/grpc/grpc-java/issues/9153 | ||
compileOnly("org.apache.tomcat:annotations-api:6.0.53") | ||
|
||
// Logging (optional) | ||
implementation("org.apache.logging.log4j:log4j-core:2.20.0") | ||
} | ||
|
||
// Configure protoc plugin | ||
protobuf { | ||
protoc { artifact = "com.google.protobuf:protoc:3.24.3" } | ||
|
||
// We need both grpc and restate codegen(s) because the restate codegen depends on the grpc one | ||
plugins { | ||
id("grpc") { artifact = "io.grpc:protoc-gen-grpc-java:1.58.0" } | ||
id("restate") { artifact = "dev.restate:protoc-gen-restate:$restateSdkVersion:all@jar" } | ||
} | ||
|
||
generateProtoTasks { | ||
all().forEach { | ||
it.plugins { | ||
id("grpc") | ||
id("restate") | ||
} | ||
} | ||
} | ||
} | ||
|
||
// Set main class | ||
application { | ||
if (project.hasProperty("mainClass")) { | ||
mainClass.set(project.property("mainClass") as String); | ||
} else { | ||
mainClass.set("dev.restate.tour.app.AppMain") | ||
} | ||
} |
Binary file not shown.
7 changes: 7 additions & 0 deletions
7
java/tour-of-restate/gradle/wrapper/gradle-wrapper.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.