From 06116e223d9821ea74c08f5934269bf315565ec7 Mon Sep 17 00:00:00 2001 From: Bruno Borges Date: Sat, 30 Nov 2019 02:12:12 -0800 Subject: [PATCH] fix readme --- README.md | 16 +++++++++++++--- .../src/main/java/io/dapr/examples/Example.java | 10 ++++++---- .../main/java/io/dapr/examples/OrderManager.java | 4 +++- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 0b66de67c..cc95bea7d 100644 --- a/README.md +++ b/README.md @@ -5,15 +5,25 @@ This is the Dapr SDK for Java, based on the auto-generated proto client.
For more info on Dapr and gRPC, visit [this link](https://github.com/dapr/docs/tree/master/howto/create-grpc-app). ### Installing + +The client will generate gRPC Client and Protobuf classes during build. + +Make sure to clone this repository including the submodules: + +```sh +git clone --recurse-submodules https://github.com/dapr/java-sdk.git +``` + +Then head over to build the Maven project: + ```sh # make sure you are in the `java-sdk` directory. -mvn package install +mvn install ``` ### Running an example ```sh cd examples/ -mvn compile dapr run --protocol grpc --grpc-port 50001 -- mvn exec:java -Dexec.mainClass=io.dapr.examples.Example ``` @@ -30,7 +40,7 @@ https://maven.apache.org/plugins/maven-deploy-plugin https://help.sonatype.com/repomanager3/user-interface/uploading-components -### Releasing with Maven +### Maven Module version management To increase the version of all modules and pom files, run the following commands: ```sh diff --git a/examples/src/main/java/io/dapr/examples/Example.java b/examples/src/main/java/io/dapr/examples/Example.java index dde4dc2c7..244fc8c46 100644 --- a/examples/src/main/java/io/dapr/examples/Example.java +++ b/examples/src/main/java/io/dapr/examples/Example.java @@ -1,5 +1,7 @@ package io.dapr.examples; +import static java.lang.System.out; + import com.google.protobuf.Any; import com.google.protobuf.ByteString; @@ -27,19 +29,19 @@ public class Example { var data = Any.newBuilder().setValue(ByteString.copyFromUtf8("foo")).build(); client.publishEvent(PublishEventEnvelope.newBuilder().setTopic("foo").setData(data).build()); - System.out.println("Published!"); + out.println("Published!"); var key = "mykey"; var req = StateRequest.newBuilder().setKey(key) .setValue(Any.newBuilder().setValue(ByteString.copyFromUtf8("my value")).build()).build(); var state = SaveStateEnvelope.newBuilder().addRequests(req).build(); client.saveState(state); - System.out.println("Saved!"); + out.println("Saved!"); var get = client.getState(GetStateEnvelope.newBuilder().setKey(key).build()); - System.out.println("Got: " + get.getData().getValue().toStringUtf8()); + out.println("Got: " + get.getData().getValue().toStringUtf8()); client.deleteState(DeleteStateEnvelope.newBuilder().setKey(key).build()); - System.out.println("Deleted!"); + out.println("Deleted!"); } } diff --git a/examples/src/main/java/io/dapr/examples/OrderManager.java b/examples/src/main/java/io/dapr/examples/OrderManager.java index 5397e82ea..662c84bc8 100644 --- a/examples/src/main/java/io/dapr/examples/OrderManager.java +++ b/examples/src/main/java/io/dapr/examples/OrderManager.java @@ -24,7 +24,9 @@ import com.sun.net.httpserver.HttpServer; import com.sun.net.httpserver.HttpExchange; /** - * OrderManager + * OrderManager web app. + * + * Based on the helloworld Node.js example in https://github.com/dapr/samples/blob/master/1.hello-world/app.js */ public class OrderManager {