fix readme

This commit is contained in:
Bruno Borges 2019-11-30 02:12:12 -08:00
parent 37fa7d9542
commit 06116e223d
3 changed files with 22 additions and 8 deletions

View File

@ -5,15 +5,25 @@ This is the Dapr SDK for Java, based on the auto-generated proto client.<br>
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

View File

@ -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!");
}
}

View File

@ -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 {