mirror of https://github.com/dapr/docs.git
add java and go for review
Signed-off-by: Hannah Hunter <hannahhunter@microsoft.com>
This commit is contained in:
parent
86fdd45481
commit
ad6a18a2e8
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue