-
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.
Create java/patterns and add compensations pattern
This fixes #52.
- Loading branch information
1 parent
786b971
commit c7c99fb
Showing
14 changed files
with
791 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Java examples | ||
|
||
This directory contains Restate examples using the Java SDK. | ||
|
||
## Common patterns | ||
|
||
- A collection of [common patterns](patterns) you encounter when developing distributed applications. | ||
|
||
## Starter examples | ||
|
||
- [Hello World](hello-world-http): A simple example of a Restate service. | ||
- [Hello World - AWS Lambda](hello-world-lambda): A simple example of how you can run a Restate service on AWS Lambda. | ||
|
||
## Applications | ||
- [Food ordering](food-ordering): See how to integrate Restate with external services using Awakeables and side effects. |
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,35 @@ | ||
# Compiled class file | ||
*.class | ||
|
||
# Log file | ||
*.log | ||
|
||
# BlueJ files | ||
*.ctxt | ||
|
||
# Mobile Tools for Java (J2ME) | ||
.mtj.tmp/ | ||
|
||
# Package Files # | ||
*.jar | ||
*.war | ||
*.nar | ||
*.ear | ||
*.zip | ||
*.tar.gz | ||
*.rar | ||
|
||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | ||
hs_err_pid* | ||
|
||
# Ignore Gradle project-specific cache directory | ||
.gradle | ||
|
||
# Ignore Gradle build output directory | ||
build | ||
|
||
.idea | ||
*.iml | ||
|
||
# Unignore the gradle wrapper | ||
!gradle/wrapper/gradle-wrapper.jar |
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,11 @@ | ||
# Restate Sample Patterns | ||
|
||
A collections of useful patterns in distributed applications, and how to | ||
implement them with [Restate](https://github.com/restatedev/restate). | ||
This is a continuously evolving list. | ||
|
||
All patterns are described in one file and have a comment block at the top that explains them. | ||
|
||
### List of Patterns | ||
|
||
- [**Compensations**](src/main/java/dev/restate/patterns/Compensations.java) |
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,71 @@ | ||
import com.google.protobuf.gradle.id | ||
|
||
plugins { | ||
java | ||
application | ||
|
||
id("com.google.protobuf") version "0.9.1" | ||
id("com.diffplug.spotless") version "6.24.0" | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
val restateVersion = "0.7.0" | ||
|
||
dependencies { | ||
// Restate SDK | ||
implementation("dev.restate:sdk-api:$restateVersion") | ||
implementation("dev.restate:sdk-http-vertx:$restateVersion") | ||
// To use Jackson to read/write state entries (optional) | ||
implementation("dev.restate:sdk-serde-jackson:$restateVersion") | ||
|
||
// 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") | ||
|
||
// Testing (optional) | ||
testImplementation("org.junit.jupiter:junit-jupiter:5.9.1") | ||
testImplementation("dev.restate:sdk-testing:$restateVersion") | ||
} | ||
|
||
configure<com.diffplug.gradle.spotless.SpotlessExtension> { | ||
java { | ||
targetExclude("build/generated/**/*.java") | ||
|
||
googleJavaFormat() | ||
} | ||
} | ||
|
||
// 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:$restateVersion:all@jar" } | ||
} | ||
|
||
generateProtoTasks { | ||
all().forEach { | ||
it.plugins { | ||
id("grpc") | ||
id("restate") | ||
} | ||
} | ||
} | ||
} | ||
|
||
// Configure test platform | ||
tasks.withType<Test> { | ||
useJUnitPlatform() | ||
} |
Binary file not shown.
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.