Signed-off-by: Hannah Hunter <hannahhunter@microsoft.com>
This commit is contained in:
Hannah Hunter 2023-05-01 10:24:57 -04:00
commit b00b66252b
16 changed files with 116 additions and 58 deletions

View File

@ -71,7 +71,7 @@ To provide scalability and reliability, actors instances are throughout the clu
You can invoke actor methods by calling them over HTTP, as shown in the general example below. You can invoke actor methods by calling them over HTTP, as shown in the general example below.
<img src="/images/actors_background_placement_service_registration.png" width=600> <img src="/images/actors-calling-method.png" width=900>
1. The service calls the actor API on the sidecar. 1. The service calls the actor API on the sidecar.
1. With the cached partitioning information from the placement service, the sidecar determines which actor service instance will host actor ID **3**. The call is forwarded to the appropriate sidecar. 1. With the cached partitioning information from the placement service, the sidecar determines which actor service instance will host actor ID **3**. The call is forwarded to the appropriate sidecar.

View File

@ -270,7 +270,11 @@ const daprHost = "127.0.0.1";
async function sendOrder(orderId) { async function sendOrder(orderId) {
const BINDING_NAME = "checkout"; const BINDING_NAME = "checkout";
const BINDING_OPERATION = "create"; const BINDING_OPERATION = "create";
const client = new DaprClient(daprHost, process.env.DAPR_HTTP_PORT, CommunicationProtocolEnum.HTTP); const client = new DaprClient({
daprHost,
daprPort: process.env.DAPR_HTTP_PORT,
communicationProtocol: CommunicationProtocolEnum.HTTP,
});
//Using Dapr SDK to invoke output binding //Using Dapr SDK to invoke output binding
const result = await client.binding.send(BINDING_NAME, BINDING_OPERATION, orderId); const result = await client.binding.send(BINDING_NAME, BINDING_OPERATION, orderId);
console.log("Sending message: " + orderId); console.log("Sending message: " + orderId);

View File

@ -237,7 +237,15 @@ start().catch((e) => {
}); });
async function start() { async function start() {
const server = new DaprServer(serverHost, serverPort, daprHost, daprPort, CommunicationProtocolEnum.HTTP); const server = new DaprServer({
serverHost,
serverPort,
communicationProtocol: CommunicationProtocolEnum.HTTP,
clientOptions: {
daprHost,
daprPort,
}
});
await server.binding.receive('checkout', async (orderId) => console.log(`Received Message: ${JSON.stringify(orderId)}`)); await server.binding.receive('checkout', async (orderId) => console.log(`Received Message: ${JSON.stringify(orderId)}`));
await server.startServer(); await server.startServer();
} }

View File

@ -355,13 +355,15 @@ start().catch((e) => {
}); });
async function start(orderId) { async function start(orderId) {
const server = new DaprServer( const server = new DaprServer({
serverHost, serverHost,
serverPort, serverPort,
daprHost, communicationProtocol: CommunicationProtocolEnum.HTTP,
process.env.DAPR_HTTP_PORT, clientOptions: {
CommunicationProtocolEnum.HTTP daprHost,
); daprPort: process.env.DAPR_HTTP_PORT,
},
});
//Subscribe to a topic //Subscribe to a topic
await server.pubsub.subscribe("order-pub-sub", "orders", async (orderId) => { await server.pubsub.subscribe("order-pub-sub", "orders", async (orderId) => {
console.log(`Subscriber received: ${JSON.stringify(orderId)}`) console.log(`Subscriber received: ${JSON.stringify(orderId)}`)
@ -625,7 +627,11 @@ var main = function() {
async function start(orderId) { async function start(orderId) {
const PUBSUB_NAME = "order-pub-sub" const PUBSUB_NAME = "order-pub-sub"
const TOPIC_NAME = "orders" const TOPIC_NAME = "orders"
const client = new DaprClient(daprHost, process.env.DAPR_HTTP_PORT, CommunicationProtocolEnum.HTTP); const client = new DaprClient({
daprHost,
daprPort: process.env.DAPR_HTTP_PORT,
communicationProtocol: CommunicationProtocolEnum.HTTP
});
console.log("Published data:" + orderId) console.log("Published data:" + orderId)
//Using Dapr SDK to publish a topic //Using Dapr SDK to publish a topic
await client.pubsub.publish(PUBSUB_NAME, TOPIC_NAME, orderId); await client.pubsub.publish(PUBSUB_NAME, TOPIC_NAME, orderId);

View File

@ -313,10 +313,17 @@ A JSON-encoded payload body with the processing status against each entry needs
```json ```json
{ {
"statuses": { "statuses":
"entryId": "<entryId>", [
{
"entryId": "<entryId1>",
"status": "<status>" "status": "<status>"
} },
{
"entryId": "<entryId2>",
"status": "<status>"
}
]
} }
``` ```
@ -334,7 +341,7 @@ Please refer [Expected HTTP Response for Bulk Subscribe]({{< ref pubsub_api.md >
Please refer following code samples for how to use Bulk Subscribe: Please refer following code samples for how to use Bulk Subscribe:
{{< tabs "Java" "JavaScript" ".NET" "HTTP API (Bash)" "HTTP API (PowerShell)" >}} {{< tabs "Java" "JavaScript" ".NET" >}}
{{% codetab %}} {{% codetab %}}
@ -387,13 +394,20 @@ import { DaprServer } from "@dapr/dapr";
const pubSubName = "orderPubSub"; const pubSubName = "orderPubSub";
const topic = "topicbulk"; const topic = "topicbulk";
const DAPR_HOST = process.env.DAPR_HOST || "127.0.0.1"; const daprHost = process.env.DAPR_HOST || "127.0.0.1";
const DAPR_HTTP_PORT = process.env.DAPR_HTTP_PORT || "3502"; const daprPort = process.env.DAPR_HTTP_PORT || "3502";
const SERVER_HOST = process.env.SERVER_HOST || "127.0.0.1"; const serverHost = process.env.SERVER_HOST || "127.0.0.1";
const SERVER_PORT = process.env.APP_PORT || 5001; const serverPort = process.env.APP_PORT || 5001;
async function start() { async function start() {
const server = new DaprServer(SERVER_HOST, SERVER_PORT, DAPR_HOST, DAPR_HTTP_PORT); const server = new DaprServer({
serverHost,
serverPort,
clientOptions: {
daprHost,
daprPort,
},
});
// Publish multiple messages to a topic with default config. // Publish multiple messages to a topic with default config.
await client.pubsub.bulkSubscribeWithDefaultConfig(pubSubName, topic, (data) => console.log("Subscriber received: " + JSON.stringify(data))); await client.pubsub.bulkSubscribeWithDefaultConfig(pubSubName, topic, (data) => console.log("Subscriber received: " + JSON.stringify(data)));

View File

@ -218,7 +218,11 @@ import { DaprClient, HttpMethod, CommunicationProtocolEnum } from '@dapr/dapr';
const daprHost = "127.0.0.1"; const daprHost = "127.0.0.1";
async function main() { async function main() {
const client = new DaprClient(daprHost, process.env.DAPR_HTTP_PORT, CommunicationProtocolEnum.HTTP); const client = new DaprClient({
daprHost,
daprPort: process.env.DAPR_HTTP_PORT,
communicationProtocol: CommunicationProtocolEnum.HTTP,
});
const SECRET_STORE_NAME = "localsecretstore"; const SECRET_STORE_NAME = "localsecretstore";
//Using Dapr SDK to get a secret //Using Dapr SDK to get a secret
var secret = await client.secret.get(SECRET_STORE_NAME, "secret"); var secret = await client.secret.get(SECRET_STORE_NAME, "secret");

View File

@ -347,7 +347,12 @@ var main = function() {
} }
async function start(orderId) { async function start(orderId) {
const client = new DaprClient(daprHost, process.env.DAPR_HTTP_PORT, CommunicationProtocolEnum.HTTP); const client = new DaprClient({
daprHost: daprHost,
daprPort: process.env.DAPR_HTTP_PORT,
communicationProtocol: CommunicationProtocolEnum.HTTP
});
//Using Dapr SDK to invoke a method //Using Dapr SDK to invoke a method
const result = await client.invoker.invoke('checkoutservice' , "checkout/" + orderId , HttpMethod.GET); const result = await client.invoker.invoke('checkoutservice' , "checkout/" + orderId , HttpMethod.GET);
console.log("Order requested: " + orderId); console.log("Order requested: " + orderId);

View File

@ -266,7 +266,11 @@ var main = function() {
} }
async function start(orderId) { async function start(orderId) {
const client = new DaprClient(daprHost, process.env.DAPR_HTTP_PORT, CommunicationProtocolEnum.HTTP); const client = new DaprClient({
daprHost,
daprPort: process.env.DAPR_HTTP_PORT,
communicationProtocol: CommunicationProtocolEnum.HTTP,
});
const STATE_STORE_NAME = "statestore"; const STATE_STORE_NAME = "statestore";
//Using Dapr SDK to save and get state //Using Dapr SDK to save and get state
await client.state.save(STATE_STORE_NAME, [ await client.state.save(STATE_STORE_NAME, [
@ -483,7 +487,12 @@ const daprHost = "127.0.0.1";
var main = function() { var main = function() {
const STATE_STORE_NAME = "statestore"; const STATE_STORE_NAME = "statestore";
//Using Dapr SDK to save and get state //Using Dapr SDK to save and get state
const client = new DaprClient(daprHost, process.env.DAPR_HTTP_PORT, CommunicationProtocolEnum.HTTP); const client = new DaprClient({
daprHost,
daprPort: process.env.DAPR_HTTP_PORT,
communicationProtocol: CommunicationProtocolEnum.HTTP,
});
await client.state.delete(STATE_STORE_NAME, "order_1"); await client.state.delete(STATE_STORE_NAME, "order_1");
} }
@ -630,7 +639,12 @@ var main = function() {
const STATE_STORE_NAME = "statestore"; const STATE_STORE_NAME = "statestore";
var orderId = 100; var orderId = 100;
//Using Dapr SDK to save and retrieve multiple states //Using Dapr SDK to save and retrieve multiple states
const client = new DaprClient(daprHost, process.env.DAPR_HTTP_PORT, CommunicationProtocolEnum.HTTP); const client = new DaprClient({
daprHost,
daprPort: process.env.DAPR_HTTP_PORT,
communicationProtocol: CommunicationProtocolEnum.HTTP,
});
await client.state.save(STATE_STORE_NAME, [ await client.state.save(STATE_STORE_NAME, [
{ {
key: "order_1", key: "order_1",
@ -870,7 +884,12 @@ var main = function() {
} }
async function start(orderId) { async function start(orderId) {
const client = new DaprClient(daprHost, process.env.DAPR_HTTP_PORT, CommunicationProtocolEnum.HTTP); const client = new DaprClient({
daprHost,
daprPort: process.env.DAPR_HTTP_PORT,
communicationProtocol: CommunicationProtocolEnum.HTTP,
});
const STATE_STORE_NAME = "statestore"; const STATE_STORE_NAME = "statestore";
//Using Dapr SDK to save and retrieve multiple states //Using Dapr SDK to save and retrieve multiple states
await client.state.transaction(STATE_STORE_NAME, [ await client.state.transaction(STATE_STORE_NAME, [

View File

@ -44,7 +44,7 @@ When running Dapr (or the Dapr runtime directly) in stand-alone mode, you have t
FOO=bar daprd --app-id myapp FOO=bar daprd --app-id myapp
``` ```
If you have [configured named AWS profiles](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) locally , you can tell Dapr (or the Dapr runtime) which profile to use by specifying the "AWS_PROFILE" environment variable: If you have [configured named AWS profiles](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html) locally , you can tell Dapr (or the Dapr runtime) which profile to use by specifying the "AWS_PROFILE" environment variable:
```bash ```bash
AWS_PROFILE=myprofile dapr run... AWS_PROFILE=myprofile dapr run...

View File

@ -273,7 +273,7 @@ dapr run --app-id checkout --app-protocol http --dapr-http-port 3500 --resources
In the `checkout` publisher service, we're publishing the orderId message to the Redis instance called `orderpubsub` [(as defined in the `pubsub.yaml` component)]({{< ref "#pubsubyaml-component-file" >}}) and topic `orders`. As soon as the service starts, it publishes in a loop: In the `checkout` publisher service, we're publishing the orderId message to the Redis instance called `orderpubsub` [(as defined in the `pubsub.yaml` component)]({{< ref "#pubsubyaml-component-file" >}}) and topic `orders`. As soon as the service starts, it publishes in a loop:
```js ```js
const client = new DaprClient(DAPR_HOST, DAPR_HTTP_PORT); const client = new DaprClient();
await client.pubsub.publish(PUBSUB_NAME, PUBSUB_TOPIC, order); await client.pubsub.publish(PUBSUB_NAME, PUBSUB_TOPIC, order);
console.log("Published data: " + JSON.stringify(order)); console.log("Published data: " + JSON.stringify(order));

View File

@ -177,29 +177,19 @@ dapr run --app-id order-processor --resources-path ../../../resources/ -- npm ru
The `order-processor` service writes, reads, and deletes an `orderId` key/value pair to the `statestore` instance [defined in the `statestore.yaml` component]({{< ref "#statestoreyaml-component-file" >}}). As soon as the service starts, it performs a loop. The `order-processor` service writes, reads, and deletes an `orderId` key/value pair to the `statestore` instance [defined in the `statestore.yaml` component]({{< ref "#statestoreyaml-component-file" >}}). As soon as the service starts, it performs a loop.
```js ```js
const client = new DaprClient(DAPR_HOST, DAPR_HTTP_PORT); const client = new DaprClient()
// Save state into the state store // Save state into a state store
client.state.save(STATE_STORE_NAME, [ await client.state.save(DAPR_STATE_STORE_NAME, state)
{ console.log("Saving Order: ", order)
key: orderId.toString(),
value: order
}
]);
console.log("Saving Order: ", order);
// Get state from the state store // Get state from a state store
var result = client.state.get(STATE_STORE_NAME, orderId.toString()); const savedOrder = await client.state.get(DAPR_STATE_STORE_NAME, order.orderId)
result.then(function(val) { console.log("Getting Order: ", savedOrd)
console.log("Getting Order: ", val);
});
// Delete state from the state store
client.state.delete(STATE_STORE_NAME, orderId.toString());
result.then(function(val) {
console.log("Deleting Order: ", val);
});
// Delete state from the state store
await client.state.delete(DAPR_STATE_STORE_NAME, order.orderId)
console.log("Deleting Order: ", order)
``` ```
### Step 3: View the order-processor outputs ### Step 3: View the order-processor outputs

View File

@ -34,7 +34,8 @@ The table below shows the versions of Dapr releases that have been tested togeth
| Release date | Runtime | CLI | SDKs | Dashboard | Status | | Release date | Runtime | CLI | SDKs | Dashboard | Status |
|--------------------|:--------:|:--------|---------|---------|---------| |--------------------|:--------:|:--------|---------|---------|---------|
| March 16 2023 | 1.10.4</br> | 1.10.0 | Java 1.8.0 </br>Go 1.6.0 </br>PHP 1.1.0 </br>Python 1.9.0 </br>.NET 1.10.0 </br>JS 2.5.0 | 0.11.0 | Supported (current) | | April 13 2023 | 1.10.5</br> | 1.10.0 | Java 1.8.0 </br>Go 1.6.0 </br>PHP 1.1.0 </br>Python 1.9.0 </br>.NET 1.10.0 </br>JS 2.5.0 | 0.11.0 | Supported (current) |
| March 16 2023 | 1.10.4</br> | 1.10.0 | Java 1.8.0 </br>Go 1.6.0 </br>PHP 1.1.0 </br>Python 1.9.0 </br>.NET 1.10.0 </br>JS 2.5.0 | 0.11.0 | Supported |
| March 14 2023 | 1.10.3</br> | 1.10.0 | Java 1.8.0 </br>Go 1.6.0 </br>PHP 1.1.0 </br>Python 1.9.0 </br>.NET 1.10.0 </br>JS 2.5.0 | 0.11.0 | Supported | | March 14 2023 | 1.10.3</br> | 1.10.0 | Java 1.8.0 </br>Go 1.6.0 </br>PHP 1.1.0 </br>Python 1.9.0 </br>.NET 1.10.0 </br>JS 2.5.0 | 0.11.0 | Supported |
| February 24 2023 | 1.10.2</br> | 1.10.0 | Java 1.8.0 </br>Go 1.6.0 </br>PHP 1.1.0 </br>Python 1.9.0 </br>.NET 1.10.0 </br>JS 2.5.0 | 0.11.0 | Supported | | February 24 2023 | 1.10.2</br> | 1.10.0 | Java 1.8.0 </br>Go 1.6.0 </br>PHP 1.1.0 </br>Python 1.9.0 </br>.NET 1.10.0 </br>JS 2.5.0 | 0.11.0 | Supported |
| February 20 2023 | 1.10.1</br> | 1.10.0 | Java 1.8.0 </br>Go 1.6.0 </br>PHP 1.1.0 </br>Python 1.9.0 </br>.NET 1.10.0 </br>JS 2.5.0 | 0.11.0 | Supported | | February 20 2023 | 1.10.1</br> | 1.10.0 | Java 1.8.0 </br>Go 1.6.0 </br>PHP 1.1.0 </br>Python 1.9.0 </br>.NET 1.10.0 </br>JS 2.5.0 | 0.11.0 | Supported |
@ -91,17 +92,17 @@ General guidance on upgrading can be found for [self hosted mode]({{< ref self-h
| | 1.6.2 | 1.7.5 | | | 1.6.2 | 1.7.5 |
| | 1.7.5 | 1.8.6 | | | 1.7.5 | 1.8.6 |
| | 1.8.6 | 1.9.6 | | | 1.8.6 | 1.9.6 |
| | 1.9.6 | 1.10.4 | | | 1.9.6 | 1.10.5 |
| 1.6.0 to 1.6.2 | N/A | 1.7.5 | | 1.6.0 to 1.6.2 | N/A | 1.7.5 |
| | 1.7.5 | 1.8.6 | | | 1.7.5 | 1.8.6 |
| | 1.8.6 | 1.9.6 | | | 1.8.6 | 1.9.6 |
| | 1.9.6 | 1.10.4 | | | 1.9.6 | 1.10.5 |
| 1.7.0 to 1.7.5 | N/A | 1.8.6 | | 1.7.0 to 1.7.5 | N/A | 1.8.6 |
| | 1.8.6 | 1.9.6 | | | 1.8.6 | 1.9.6 |
| | 1.9.6 | 1.10.4 | | | 1.9.6 | 1.10.5 |
| 1.8.0 to 1.8.6 | N/A | 1.9.6 | | 1.8.0 to 1.8.6 | N/A | 1.9.6 |
| 1.9.0 | N/A | 1.9.6 | | 1.9.0 | N/A | 1.9.6 |
| 1.10.0 | N/A | 1.10.4 | | 1.10.0 | N/A | 1.10.5 |
## Breaking changes and deprecations ## Breaking changes and deprecations

View File

@ -262,10 +262,17 @@ A JSON-encoded payload body with the processing status against each entry needs
```json ```json
{ {
"statuses": { "statuses":
"entryId": "<entryId>", [
{
"entryId": "<entryId1>",
"status": "<status>" "status": "<status>"
} },
{
"entryId": "<entryId2>",
"status": "<status>"
}
]
} }
``` ```

View File

@ -69,7 +69,7 @@ app.post('/scheduled', async function(req, res){
}); });
``` ```
When running this code, note that the `/scheduled` endpoint is called every five minutes by the Dapr sidecar. When running this code, note that the `/scheduled` endpoint is called every fifteen minutes by the Dapr sidecar.
## Binding support ## Binding support

View File

@ -1 +1 @@
{{- if .Get "short" }}1.10{{ else if .Get "long" }}1.10.4{{ else if .Get "cli" }}1.10.0{{ else }}1.10.4{{ end -}} {{- if .Get "short" }}1.10{{ else if .Get "long" }}1.10.5{{ else if .Get "cli" }}1.10.0{{ else }}1.10.5{{ end -}}

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB