add java and go for review

Signed-off-by: Hannah Hunter <hannahhunter@microsoft.com>
This commit is contained in:
Hannah Hunter 2023-03-07 11:44:11 -06:00
parent 86fdd45481
commit ad6a18a2e8
1 changed files with 11 additions and 1 deletions

View File

@ -91,10 +91,15 @@ dapr run --app-id orderprocessing --app-port 6001 --dapr-http-port 3601 --dapr-g
```java
//dependencies
import io.dapr.client.DaprClient;
import io.dapr.client.DaprClientBuilder;
//code
client.saveState(STATE_STORE_NAME, "order_1", Integer.toString(orderId)).block();
client.saveState(STATE_STORE_NAME, "order_2", Integer.toString(orderId)).block();
Mono<State<String>> result = client.getState(STATE_STORE_NAME, "order_1", String.class);
log.info("Result after get" + result, singletonMap(Metadata.TTL_IN_SECONDS));
```
To launch a Dapr sidecar and run the above example application, you'd then run a command similar to the following:
@ -112,9 +117,14 @@ dapr run --app-id orderprocessing --app-port 6001 --dapr-http-port 3601 --dapr-g
```go
// dependencies
import (
dapr "github.com/dapr/go-sdk/client"
)
// code
err = client.SaveState(ctx, STATE_STORE_NAME, "order_1", []byte(strconv.Itoa(orderId)), nil)
Metadata: map[string]string{"ttlInSeconds": "120"},
```
To launch a Dapr sidecar and run the above example application, you'd then run a command similar to the following: