mirror of https://github.com/dapr/docs.git
Merge branch 'v1.15' into workflow-dotnet
This commit is contained in:
commit
c38cc6de42
|
|
@ -18,4 +18,4 @@ jobs:
|
||||||
stale-pr-message: 'Stale PR, paging all reviewers'
|
stale-pr-message: 'Stale PR, paging all reviewers'
|
||||||
stale-pr-label: 'stale'
|
stale-pr-label: 'stale'
|
||||||
exempt-pr-labels: 'question,"help wanted",do-not-merge,waiting-on-code-pr'
|
exempt-pr-labels: 'question,"help wanted",do-not-merge,waiting-on-code-pr'
|
||||||
days-before-stale: 30
|
days-before-stale: 90
|
||||||
|
|
|
||||||
|
|
@ -110,40 +110,30 @@ The code examples below leverage Dapr SDKs to invoke the output bindings endpoin
|
||||||
|
|
||||||
{{% codetab %}}
|
{{% codetab %}}
|
||||||
|
|
||||||
|
Here's an example of using a console app with top-level statements in .NET 6+:
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
//dependencies
|
using System.Text;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Net.Http;
|
|
||||||
using System.Net.Http.Headers;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Dapr.Client;
|
using Dapr.Client;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using System.Threading;
|
|
||||||
|
|
||||||
//code
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
namespace EventService
|
builder.Services.AddDaprClient();
|
||||||
{
|
var app = builder.Build();
|
||||||
class Program
|
|
||||||
{
|
const string BINDING_NAME = "checkout";
|
||||||
static async Task Main(string[] args)
|
const string BINDING_OPERATION = "create";
|
||||||
{
|
|
||||||
string BINDING_NAME = "checkout";
|
var random = new Random();
|
||||||
string BINDING_OPERATION = "create";
|
using var daprClient = app.Services.GetRequiredService<DaprClient>();
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
System.Threading.Thread.Sleep(5000);
|
await Task.Delay(TimeSpan.FromSeconds(5));
|
||||||
Random random = new Random();
|
var orderId = random.Next(1, 1000);
|
||||||
int orderId = random.Next(1,1000);
|
|
||||||
using var client = new DaprClientBuilder().Build();
|
|
||||||
//Using Dapr SDK to invoke output binding
|
|
||||||
await client.InvokeBindingAsync(BINDING_NAME, BINDING_OPERATION, orderId);
|
await client.InvokeBindingAsync(BINDING_NAME, BINDING_OPERATION, orderId);
|
||||||
Console.WriteLine("Sending message: " + orderId);
|
Console.WriteLine($"Sending message: {orderId}");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
{{% /codetab %}}
|
{{% /codetab %}}
|
||||||
|
|
|
||||||
|
|
@ -119,28 +119,35 @@ Below are code examples that leverage Dapr SDKs to demonstrate an input binding.
|
||||||
|
|
||||||
{{% codetab %}}
|
{{% codetab %}}
|
||||||
|
|
||||||
|
The following example demonstrates how to configure an input binding using ASP.NET Core controllers.
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
//dependencies
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
//code
|
namespace CheckoutService.controller;
|
||||||
namespace CheckoutService.controller
|
|
||||||
{
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
public class CheckoutServiceController : Controller
|
public sealed class CheckoutServiceController : ControllerBase
|
||||||
{
|
{
|
||||||
[HttpPost("/checkout")]
|
[HttpPost("/checkout")]
|
||||||
public ActionResult<string> getCheckout([FromBody] int orderId)
|
public ActionResult<string> getCheckout([FromBody] int orderId)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Received Message: " + orderId);
|
Console.WriteLine($"Received Message: {orderId}");
|
||||||
return "CID" + orderId;
|
return $"CID{orderId}";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The following example demonstrates how to configure the same input binding using a minimal API approach:
|
||||||
|
```csharp
|
||||||
|
app.MapPost("checkout", ([FromBody] int orderId) =>
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Received Message: {orderId}");
|
||||||
|
return $"CID{orderId}"
|
||||||
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
{{% /codetab %}}
|
{{% /codetab %}}
|
||||||
|
|
|
||||||
|
|
@ -76,27 +76,21 @@ The following example shows how to get a saved configuration item using the Dapr
|
||||||
{{% codetab %}}
|
{{% codetab %}}
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
//dependencies
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Dapr.Client;
|
using Dapr.Client;
|
||||||
|
|
||||||
//code
|
const string CONFIG_STORE_NAME = "configstore";
|
||||||
namespace ConfigurationApi
|
|
||||||
{
|
|
||||||
public class Program
|
|
||||||
{
|
|
||||||
private static readonly string CONFIG_STORE_NAME = "configstore";
|
|
||||||
|
|
||||||
public static async Task Main(string[] args)
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
{
|
builder.Services.AddDaprClient();
|
||||||
using var client = new DaprClientBuilder().Build();
|
var app = builder.Build();
|
||||||
var configuration = await client.GetConfiguration(CONFIG_STORE_NAME, new List<string>() { "orderId1", "orderId2" });
|
|
||||||
|
using var client = app.Services.GetRequiredServices<DaprClient>();
|
||||||
|
|
||||||
|
var configuration = await client.GetConfiguration(CONFIG_STORE_NAME, [ "orderId1", "orderId2" ]);
|
||||||
Console.WriteLine($"Got key=\n{configuration[0].Key} -> {configuration[0].Value}\n{configuration[1].Key} -> {configuration[1].Value}");
|
Console.WriteLine($"Got key=\n{configuration[0].Key} -> {configuration[0].Value}\n{configuration[1].Key} -> {configuration[1].Value}");
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
{{% /codetab %}}
|
{{% /codetab %}}
|
||||||
|
|
@ -261,13 +255,19 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Dapr.Client;
|
using Dapr.Client;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
const string DAPR_CONFIGURATION_STORE = "configstore";
|
const string DAPR_CONFIGURATION_STORE = "configstore";
|
||||||
var CONFIGURATION_ITEMS = new List<string> { "orderId1", "orderId2" };
|
var CONFIGURATION_ITEMS = new List<string> { "orderId1", "orderId2" };
|
||||||
var client = new DaprClientBuilder().Build();
|
|
||||||
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
builder.Services.AddDaprClient();
|
||||||
|
var app = builder.Build();
|
||||||
|
|
||||||
|
var client = app.Services.GetRequiredService<DaprClient>();
|
||||||
|
|
||||||
// Subscribe for configuration changes
|
// Subscribe for configuration changes
|
||||||
SubscribeConfigurationResponse subscribe = await client.SubscribeConfiguration(DAPR_CONFIGURATION_STORE, CONFIGURATION_ITEMS);
|
var subscribe = await client.SubscribeConfiguration(DAPR_CONFIGURATION_STORE, CONFIGURATION_ITEMS);
|
||||||
|
|
||||||
// Print configuration changes
|
// Print configuration changes
|
||||||
await foreach (var items in subscribe.Source)
|
await foreach (var items in subscribe.Source)
|
||||||
|
|
@ -279,7 +279,7 @@ await foreach (var items in subscribe.Source)
|
||||||
subscriptionId = subscribe.Id;
|
subscriptionId = subscribe.Id;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var cfg = System.Text.Json.JsonSerializer.Serialize(items);
|
var cfg = JsonSerializer.Serialize(items);
|
||||||
Console.WriteLine("Configuration update " + cfg);
|
Console.WriteLine("Configuration update " + cfg);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
@ -303,40 +303,23 @@ using Dapr.Extensions.Configuration;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
namespace ConfigurationApi
|
|
||||||
{
|
|
||||||
public class Program
|
|
||||||
{
|
|
||||||
public static void Main(string[] args)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Starting application.");
|
Console.WriteLine("Starting application.");
|
||||||
CreateHostBuilder(args).Build().Run();
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
Console.WriteLine("Closing application.");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
// Unlike most other situations, we build a `DaprClient` here using its factory because we cannot rely on `IConfiguration`
|
||||||
/// Creates WebHost Builder.
|
// or other injected services to configure it because we haven't yet built the DI container.
|
||||||
/// </summary>
|
|
||||||
/// <param name="args">Arguments.</param>
|
|
||||||
/// <returns>Returns IHostbuilder.</returns>
|
|
||||||
public static IHostBuilder CreateHostBuilder(string[] args)
|
|
||||||
{
|
|
||||||
var client = new DaprClientBuilder().Build();
|
var client = new DaprClientBuilder().Build();
|
||||||
return Host.CreateDefaultBuilder(args)
|
|
||||||
.ConfigureAppConfiguration(config =>
|
|
||||||
{
|
|
||||||
// Get the initial value and continue to watch it for changes.
|
|
||||||
config.AddDaprConfigurationStore("configstore", new List<string>() { "orderId1","orderId2" }, client, TimeSpan.FromSeconds(20));
|
|
||||||
config.AddStreamingDaprConfigurationStore("configstore", new List<string>() { "orderId1","orderId2" }, client, TimeSpan.FromSeconds(20));
|
|
||||||
|
|
||||||
})
|
// In a real-world application, you'd also add the following line to register the `DaprClient` with the DI container so
|
||||||
.ConfigureWebHostDefaults(webBuilder =>
|
// it can be injected into other services. In this demonstration, it's not necessary as we're not injecting it anywhere.
|
||||||
{
|
// builder.Services.AddDaprClient();
|
||||||
webBuilder.UseStartup<Startup>();
|
|
||||||
});
|
// Get the initial value and continue to watch it for changes
|
||||||
}
|
builder.Configuration.AddDaprConfigurationStore("configstore", new List<string>() { "orderId1","orderId2" }, client, TimeSpan.FromSeconds(20));
|
||||||
}
|
builder.Configuration.AddStreamingDaprConfigurationStore("configstore", new List<string>() { "orderId1","orderId2" }, client, TimeSpan.FromSeconds(20));
|
||||||
}
|
|
||||||
|
await builder.Build().RunAsync();
|
||||||
|
Console.WriteLine("Closing application.");
|
||||||
```
|
```
|
||||||
|
|
||||||
Navigate to the directory containing the above code, then run the following command to launch both a Dapr sidecar and the subscriber application:
|
Navigate to the directory containing the above code, then run the following command to launch both a Dapr sidecar and the subscriber application:
|
||||||
|
|
@ -524,29 +507,23 @@ Following are the code examples showing how you can unsubscribe to configuration
|
||||||
{{< tabs ".NET" Java Python Go JavaScript "HTTP API (BASH)" "HTTP API (Powershell)">}}
|
{{< tabs ".NET" Java Python Go JavaScript "HTTP API (BASH)" "HTTP API (Powershell)">}}
|
||||||
|
|
||||||
{{% codetab %}}
|
{{% codetab %}}
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Dapr.Client;
|
using Dapr.Client;
|
||||||
|
|
||||||
const string DAPR_CONFIGURATION_STORE = "configstore";
|
var builder = WebApplication.CreateBuilder();
|
||||||
var client = new DaprClientBuilder().Build();
|
builder.Services.AddDaprClient();
|
||||||
|
var app = builder.Build();
|
||||||
|
|
||||||
// Unsubscribe to config updates and exit the app
|
const string DAPR_CONFIGURATION_STORE = "configstore";
|
||||||
async Task unsubscribe(string subscriptionId)
|
const string SubscriptionId = "abc123"; //Replace with the subscription identifier to unsubscribe from
|
||||||
{
|
var client = app.Services.GetRequiredService<DaprClient>();
|
||||||
try
|
|
||||||
{
|
await client.UnsubscribeConfiguration(DAPR_CONFIGURATION_STORE, SubscriptionId);
|
||||||
await client.UnsubscribeConfiguration(DAPR_CONFIGURATION_STORE, subscriptionId);
|
|
||||||
Console.WriteLine("App unsubscribed from config changes");
|
Console.WriteLine("App unsubscribed from config changes");
|
||||||
Environment.Exit(0);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Error unsubscribing from config updates: " + ex.Message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
{{% /codetab %}}
|
{{% /codetab %}}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -199,7 +199,6 @@ Below are code examples that leverage Dapr SDKs to subscribe to the topic you de
|
||||||
{{% codetab %}}
|
{{% codetab %}}
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
//dependencies
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -207,21 +206,19 @@ using Microsoft.AspNetCore.Mvc;
|
||||||
using Dapr;
|
using Dapr;
|
||||||
using Dapr.Client;
|
using Dapr.Client;
|
||||||
|
|
||||||
//code
|
namespace CheckoutService.Controllers;
|
||||||
namespace CheckoutService.controller
|
|
||||||
{
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
public class CheckoutServiceController : Controller
|
public sealed class CheckoutServiceController : ControllerBase
|
||||||
{
|
{
|
||||||
//Subscribe to a topic
|
//Subscribe to a topic called "orders" from the "order-pub-sub" compoennt
|
||||||
[Topic("order-pub-sub", "orders")]
|
[Topic("order-pub-sub", "orders")]
|
||||||
[HttpPost("checkout")]
|
[HttpPost("checkout")]
|
||||||
public void getCheckout([FromBody] int orderId)
|
public void GetCheckout([FromBody] int orderId)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Subscriber received : " + orderId);
|
Console.WriteLine("Subscriber received : " + orderId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Navigate to the directory containing the above code, then run the following command to launch both a Dapr sidecar and the subscriber application:
|
Navigate to the directory containing the above code, then run the following command to launch both a Dapr sidecar and the subscriber application:
|
||||||
|
|
@ -435,39 +432,35 @@ Below are code examples that leverage Dapr SDKs to publish a topic.
|
||||||
{{% codetab %}}
|
{{% codetab %}}
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
//dependencies
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Dapr.Client;
|
using Dapr.Client;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
//code
|
const string PUBSUB_NAME = "order-pub-sub";
|
||||||
namespace EventService
|
const string TOPIC_NAME = "orders";
|
||||||
{
|
|
||||||
class Program
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
{
|
builder.Services.AddDaprClient();
|
||||||
static async Task Main(string[] args)
|
|
||||||
{
|
var app = builder.Build();
|
||||||
string PUBSUB_NAME = "order-pub-sub";
|
var random = new Random();
|
||||||
string TOPIC_NAME = "orders";
|
|
||||||
|
var client = app.Services.GetRequiredService<DaprClient>();
|
||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
System.Threading.Thread.Sleep(5000);
|
await Task.Delay(TimeSpan.FromSeconds(5));
|
||||||
Random random = new Random();
|
var orderId = random.Next(1,1000);
|
||||||
int orderId = random.Next(1,1000);
|
var source = new CancellationTokenSource();
|
||||||
CancellationTokenSource source = new CancellationTokenSource();
|
var cancellationToken = source.Token;
|
||||||
CancellationToken cancellationToken = source.Token;
|
|
||||||
using var client = new DaprClientBuilder().Build();
|
|
||||||
//Using Dapr SDK to publish a topic
|
//Using Dapr SDK to publish a topic
|
||||||
await client.PublishEventAsync(PUBSUB_NAME, TOPIC_NAME, orderId, cancellationToken);
|
await client.PublishEventAsync(PUBSUB_NAME, TOPIC_NAME, orderId, cancellationToken);
|
||||||
Console.WriteLine("Published data: " + orderId);
|
Console.WriteLine("Published data: " + orderId);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Navigate to the directory containing the above code, then run the following command to launch both a Dapr sidecar and the publisher application:
|
Navigate to the directory containing the above code, then run the following command to launch both a Dapr sidecar and the publisher application:
|
||||||
|
|
|
||||||
|
|
@ -76,32 +76,25 @@ Now that you've set up the local secret store, call Dapr to get the secrets from
|
||||||
{{% codetab %}}
|
{{% codetab %}}
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
//dependencies
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Net.Http;
|
|
||||||
using System.Net.Http.Headers;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Dapr.Client;
|
using Dapr.Client;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Text.Json;
|
|
||||||
|
|
||||||
//code
|
namespace EventService;
|
||||||
namespace EventService
|
|
||||||
{
|
const string SECRET_STORE_NAME = "localsecretstore";
|
||||||
class Program
|
|
||||||
{
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
static async Task Main(string[] args)
|
builder.Services.AddDaprClient();
|
||||||
{
|
var app = builder.Build();
|
||||||
string SECRET_STORE_NAME = "localsecretstore";
|
|
||||||
using var client = new DaprClientBuilder().Build();
|
//Resolve a DaprClient from DI
|
||||||
//Using Dapr SDK to get a secret
|
var daprClient = app.Services.GetRequiredService<DaprClient>();
|
||||||
var secret = await client.GetSecretAsync(SECRET_STORE_NAME, "secret");
|
|
||||||
|
//Use the Dapr SDK to get a secret
|
||||||
|
var secret = await daprClient.GetSecretAsync(SECRET_STORE_NAME, "secret");
|
||||||
|
|
||||||
Console.WriteLine($"Result: {string.Join(", ", secret)}");
|
Console.WriteLine($"Result: {string.Join(", ", secret)}");
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
{{% /codetab %}}
|
{{% /codetab %}}
|
||||||
|
|
|
||||||
|
|
@ -413,7 +413,7 @@ dapr invoke --app-id checkout --method checkout/100
|
||||||
You can also append a query string or a fragment to the end of the URL and Dapr will pass it through unchanged. This means that if you need to pass some additional arguments in your service invocation that aren't part of a payload or the path, you can do so by appending a `?` to the end of the URL, followed by the key/value pairs separated by `=` signs and delimited by `&`. For example:
|
You can also append a query string or a fragment to the end of the URL and Dapr will pass it through unchanged. This means that if you need to pass some additional arguments in your service invocation that aren't part of a payload or the path, you can do so by appending a `?` to the end of the URL, followed by the key/value pairs separated by `=` signs and delimited by `&`. For example:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl 'http://dapr-app-id:checkout@localhost:3602/checkout/100?basket=1234&key=abc` -X POST
|
curl 'http://dapr-app-id:checkout@localhost:3602/checkout/100?basket=1234&key=abc' -X POST
|
||||||
```
|
```
|
||||||
|
|
||||||
### Namespaces
|
### Namespaces
|
||||||
|
|
|
||||||
|
|
@ -318,8 +318,8 @@ Manage your workflow using HTTP calls. The example below plugs in the properties
|
||||||
|
|
||||||
To start your workflow with an ID `12345678`, run:
|
To start your workflow with an ID `12345678`, run:
|
||||||
|
|
||||||
```http
|
```shell
|
||||||
POST http://localhost:3500/v1.0/workflows/dapr/OrderProcessingWorkflow/start?instanceID=12345678
|
curl -X POST "http://localhost:3500/v1.0/workflows/dapr/OrderProcessingWorkflow/start?instanceID=12345678"
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that workflow instance IDs can only contain alphanumeric characters, underscores, and dashes.
|
Note that workflow instance IDs can only contain alphanumeric characters, underscores, and dashes.
|
||||||
|
|
@ -328,16 +328,16 @@ Note that workflow instance IDs can only contain alphanumeric characters, unders
|
||||||
|
|
||||||
To terminate your workflow with an ID `12345678`, run:
|
To terminate your workflow with an ID `12345678`, run:
|
||||||
|
|
||||||
```http
|
```shell
|
||||||
POST http://localhost:3500/v1.0/workflows/dapr/12345678/terminate
|
curl -X POST "http://localhost:3500/v1.0/workflows/dapr/12345678/terminate"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Raise an event
|
### Raise an event
|
||||||
|
|
||||||
For workflow components that support subscribing to external events, such as the Dapr Workflow engine, you can use the following "raise event" API to deliver a named event to a specific workflow instance.
|
For workflow components that support subscribing to external events, such as the Dapr Workflow engine, you can use the following "raise event" API to deliver a named event to a specific workflow instance.
|
||||||
|
|
||||||
```http
|
```shell
|
||||||
POST http://localhost:3500/v1.0/workflows/<workflowComponentName>/<instanceID>/raiseEvent/<eventName>
|
curl -X POST "http://localhost:3500/v1.0/workflows/<workflowComponentName>/<instanceID>/raiseEvent/<eventName>"
|
||||||
```
|
```
|
||||||
|
|
||||||
> An `eventName` can be any function.
|
> An `eventName` can be any function.
|
||||||
|
|
@ -346,14 +346,14 @@ POST http://localhost:3500/v1.0/workflows/<workflowComponentName>/<instanceID>/r
|
||||||
|
|
||||||
To plan for down-time, wait for inputs, and more, you can pause and then resume a workflow. To pause a workflow with an ID `12345678` until triggered to resume, run:
|
To plan for down-time, wait for inputs, and more, you can pause and then resume a workflow. To pause a workflow with an ID `12345678` until triggered to resume, run:
|
||||||
|
|
||||||
```http
|
```shell
|
||||||
POST http://localhost:3500/v1.0/workflows/dapr/12345678/pause
|
curl -X POST "http://localhost:3500/v1.0/workflows/dapr/12345678/pause"
|
||||||
```
|
```
|
||||||
|
|
||||||
To resume a workflow with an ID `12345678`, run:
|
To resume a workflow with an ID `12345678`, run:
|
||||||
|
|
||||||
```http
|
```shell
|
||||||
POST http://localhost:3500/v1.0/workflows/dapr/12345678/resume
|
curl -X POST "http://localhost:3500/v1.0/workflows/dapr/12345678/resume"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Purge a workflow
|
### Purge a workflow
|
||||||
|
|
@ -362,16 +362,16 @@ The purge API can be used to permanently delete workflow metadata from the under
|
||||||
|
|
||||||
Only workflow instances in the COMPLETED, FAILED, or TERMINATED state can be purged. If the workflow is in any other state, calling purge returns an error.
|
Only workflow instances in the COMPLETED, FAILED, or TERMINATED state can be purged. If the workflow is in any other state, calling purge returns an error.
|
||||||
|
|
||||||
```http
|
```shell
|
||||||
POST http://localhost:3500/v1.0/workflows/dapr/12345678/purge
|
curl -X POST "http://localhost:3500/v1.0/workflows/dapr/12345678/purge"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Get information about a workflow
|
### Get information about a workflow
|
||||||
|
|
||||||
To fetch workflow information (outputs and inputs) with an ID `12345678`, run:
|
To fetch workflow information (outputs and inputs) with an ID `12345678`, run:
|
||||||
|
|
||||||
```http
|
```shell
|
||||||
GET http://localhost:3500/v1.0/workflows/dapr/12345678
|
curl -X GET "http://localhost:3500/v1.0/workflows/dapr/12345678"
|
||||||
```
|
```
|
||||||
|
|
||||||
Learn more about these HTTP calls in the [workflow API reference guide]({{< ref workflow_api.md >}}).
|
Learn more about these HTTP calls in the [workflow API reference guide]({{< ref workflow_api.md >}}).
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ The Dapr Workflow engine is internally powered by Dapr's actor runtime. The foll
|
||||||
|
|
||||||
To use the Dapr Workflow building block, you write workflow code in your application using the Dapr Workflow SDK, which internally connects to the sidecar using a gRPC stream. This registers the workflow and any workflow activities, or tasks that workflows can schedule.
|
To use the Dapr Workflow building block, you write workflow code in your application using the Dapr Workflow SDK, which internally connects to the sidecar using a gRPC stream. This registers the workflow and any workflow activities, or tasks that workflows can schedule.
|
||||||
|
|
||||||
The engine is embedded directly into the sidecar and implemented using the [`durabletask-go`](https://github.com/microsoft/durabletask-go) framework library. This framework allows you to swap out different storage providers, including a storage provider created for Dapr that leverages internal actors behind the scenes. Since Dapr Workflows use actors, you can store workflow state in state stores.
|
The engine is embedded directly into the sidecar and implemented using the [`durabletask-go`](https://github.com/dapr/durabletask-go) framework library. This framework allows you to swap out different storage providers, including a storage provider created for Dapr that leverages internal actors behind the scenes. Since Dapr Workflows use actors, you can store workflow state in state stores.
|
||||||
|
|
||||||
## Sidecar interactions
|
## Sidecar interactions
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -147,9 +147,9 @@ Learn more about [external system interaction.]({{< ref "workflow-patterns.md#ex
|
||||||
|
|
||||||
## Workflow backend
|
## Workflow backend
|
||||||
|
|
||||||
Dapr Workflow relies on the Durable Task Framework for Go (a.k.a. [durabletask-go](https://github.com/microsoft/durabletask-go)) as the core engine for executing workflows. This engine is designed to support multiple backend implementations. For example, the [durabletask-go](https://github.com/microsoft/durabletask-go) repo includes a SQLite implementation and the Dapr repo includes an Actors implementation.
|
Dapr Workflow relies on the Durable Task Framework for Go (a.k.a. [durabletask-go](https://github.com/dapr/durabletask-go)) as the core engine for executing workflows. This engine is designed to support multiple backend implementations. For example, the [durabletask-go](https://github.com/dapr/durabletask-go) repo includes a SQLite implementation and the Dapr repo includes an Actors implementation.
|
||||||
|
|
||||||
By default, Dapr Workflow supports the Actors backend, which is stable and scalable. However, you can choose a different backend supported in Dapr Workflow. For example, [SQLite](https://github.com/microsoft/durabletask-go/tree/main/backend/sqlite)(TBD future release) could be an option for backend for local development and testing.
|
By default, Dapr Workflow supports the Actors backend, which is stable and scalable. However, you can choose a different backend supported in Dapr Workflow. For example, [SQLite](https://github.com/dapr/durabletask-go/tree/main/backend/sqlite)(TBD future release) could be an option for backend for local development and testing.
|
||||||
|
|
||||||
The backend implementation is largely decoupled from the workflow core engine or the programming model that you see. The backend primarily impacts:
|
The backend implementation is largely decoupled from the workflow core engine or the programming model that you see. The backend primarily impacts:
|
||||||
- How workflow state is stored
|
- How workflow state is stored
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
---
|
||||||
|
type: docs
|
||||||
|
title: "How to: Integrate with Argo CD"
|
||||||
|
linkTitle: "Argo CD"
|
||||||
|
weight: 9000
|
||||||
|
description: "Integrate Dapr into your GitOps pipeline"
|
||||||
|
---
|
||||||
|
|
||||||
|
[Argo CD](https://argo-cd.readthedocs.io/en/stable/) is a declarative, GitOps continuous delivery tool for Kubernetes. It enables you to manage your Kubernetes deployments by tracking the desired application state in Git repositories and automatically syncing it to your clusters.
|
||||||
|
|
||||||
|
## Integration with Dapr
|
||||||
|
|
||||||
|
You can use Argo CD to manage the deployment of Dapr control plane components and Dapr-enabled applications. By adopting a GitOps approach, you ensure that Dapr's configurations and applications are consistently deployed, versioned, and auditable across your environments. Argo CD can be easily configured to deploy Helm charts, manifests, and Dapr components stored in Git repositories.
|
||||||
|
|
||||||
|
## Sample code
|
||||||
|
|
||||||
|
A sample project demonstrating Dapr deployment with Argo CD is available at [https://github.com/dapr/samples/tree/master/dapr-argocd](https://github.com/dapr/samples/tree/master/dapr-argocd).
|
||||||
|
|
@ -305,7 +305,7 @@ The properties for the Multi-App Run template align with the `dapr run -k` CLI f
|
||||||
| `appMaxConcurrency` | N | The concurrency level of the application; default is unlimited | |
|
| `appMaxConcurrency` | N | The concurrency level of the application; default is unlimited | |
|
||||||
| `placementHostAddress` | N | Comma separated list of addresses for Dapr placement servers | `127.0.0.1:50057,127.0.0.1:50058` |
|
| `placementHostAddress` | N | Comma separated list of addresses for Dapr placement servers | `127.0.0.1:50057,127.0.0.1:50058` |
|
||||||
| `schedulerHostAddress` | N | Dapr Scheduler Service host address | `127.0.0.1:50006` |
|
| `schedulerHostAddress` | N | Dapr Scheduler Service host address | `127.0.0.1:50006` |
|
||||||
| `appSSL` | N | Enable https when Dapr invokes the application | |
|
| `appSSL` | N | Enable HTTPS when Dapr invokes the application | |
|
||||||
| `maxBodySize` | N | Max size of the request body in MB. Set the value using size units (e.g., `16Mi` for 16MB). The default is `4Mi` | `16Mi` |
|
| `maxBodySize` | N | Max size of the request body in MB. Set the value using size units (e.g., `16Mi` for 16MB). The default is `4Mi` | `16Mi` |
|
||||||
| `readBufferSize` | N | Max size of the HTTP read buffer in KB. This also limits the maximum size of HTTP headers. Set the value using size units, for example `32Ki` will support headers up to 32KB . Default is `4Ki` for 4KB | `32Ki` |
|
| `readBufferSize` | N | Max size of the HTTP read buffer in KB. This also limits the maximum size of HTTP headers. Set the value using size units, for example `32Ki` will support headers up to 32KB . Default is `4Ki` for 4KB | `32Ki` |
|
||||||
| `enableAppHealthCheck` | N | Enable the app health check on the application | `true`, `false` |
|
| `enableAppHealthCheck` | N | Enable the app health check on the application | `true`, `false` |
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ apps:
|
||||||
|
|
||||||
#### Echo mock LLM component
|
#### Echo mock LLM component
|
||||||
|
|
||||||
In [`conversation/components`](https://github.com/dapr/quickstarts/tree/master/conversation/components) directly of the quickstart, the [`conversation.yaml` file](https://github.com/dapr/quickstarts/tree/master/conversation/components/conversation.yml) configures the echo LLM component.
|
In [`conversation/components`](https://github.com/dapr/quickstarts/tree/master/conversation/components) directly of the quickstart, the [`conversation.yaml` file](https://github.com/dapr/quickstarts/tree/master/conversation/components/conversation.yaml) configures the echo LLM component.
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
apiVersion: dapr.io/v1alpha1
|
apiVersion: dapr.io/v1alpha1
|
||||||
|
|
@ -215,7 +215,7 @@ apps:
|
||||||
|
|
||||||
#### Echo mock LLM component
|
#### Echo mock LLM component
|
||||||
|
|
||||||
In [`conversation/components`](https://github.com/dapr/quickstarts/tree/master/conversation/components) directly of the quickstart, the [`conversation.yaml` file](https://github.com/dapr/quickstarts/tree/master/conversation/components/conversation.yml) configures the echo LLM component.
|
In [`conversation/components`](https://github.com/dapr/quickstarts/tree/master/conversation/components) directly of the quickstart, the [`conversation.yaml` file](https://github.com/dapr/quickstarts/tree/master/conversation/components/conversation.yaml) configures the echo LLM component.
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
apiVersion: dapr.io/v1alpha1
|
apiVersion: dapr.io/v1alpha1
|
||||||
|
|
@ -345,7 +345,7 @@ apps:
|
||||||
|
|
||||||
#### Echo mock LLM component
|
#### Echo mock LLM component
|
||||||
|
|
||||||
In [`conversation/components`](https://github.com/dapr/quickstarts/tree/master/conversation/components), the [`conversation.yaml` file](https://github.com/dapr/quickstarts/tree/master/conversation/components/conversation.yml) configures the echo mock LLM component.
|
In [`conversation/components`](https://github.com/dapr/quickstarts/tree/master/conversation/components), the [`conversation.yaml` file](https://github.com/dapr/quickstarts/tree/master/conversation/components/conversation.yaml) configures the echo mock LLM component.
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
apiVersion: dapr.io/v1alpha1
|
apiVersion: dapr.io/v1alpha1
|
||||||
|
|
@ -475,7 +475,7 @@ apps:
|
||||||
|
|
||||||
#### Echo mock LLM component
|
#### Echo mock LLM component
|
||||||
|
|
||||||
In [`conversation/components`](https://github.com/dapr/quickstarts/tree/master/conversation/components) directly of the quickstart, the [`conversation.yaml` file](https://github.com/dapr/quickstarts/tree/master/conversation/components/conversation.yml) configures the echo LLM component.
|
In [`conversation/components`](https://github.com/dapr/quickstarts/tree/master/conversation/components) directly of the quickstart, the [`conversation.yaml` file](https://github.com/dapr/quickstarts/tree/master/conversation/components/conversation.yaml) configures the echo LLM component.
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
apiVersion: dapr.io/v1alpha1
|
apiVersion: dapr.io/v1alpha1
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ This guide walks you through installing an Azure Kubernetes Service (AKS) cluste
|
||||||
1. Create an AKS cluster. To use a specific version of Kubernetes, use `--kubernetes-version` (1.13.x or newer version required).
|
1. Create an AKS cluster. To use a specific version of Kubernetes, use `--kubernetes-version` (1.13.x or newer version required).
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
az aks create --resource-group [your_resource_group] --name [your_aks_cluster_name] --node-count 2 --enable-addons http_application_routing --generate-ssh-keys
|
az aks create --resource-group [your_resource_group] --name [your_aks_cluster_name] --location [region] --node-count 2 --enable-app-routing --generate-ssh-keys
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Get the access credentials for the AKS cluster.
|
1. Get the access credentials for the AKS cluster.
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ No matter which deployment approach you choose, it is important to understand th
|
||||||
{{% /alert %}}
|
{{% /alert %}}
|
||||||
|
|
||||||
|
|
||||||
### `DeamonSet`(Per-node)
|
### `DaemonSet`(Per-node)
|
||||||
|
|
||||||
With Kubernetes `DaemonSet`, you can define applications that need to be deployed once per node in the cluster. This enables applications that are running on the same node to communicate with local Dapr APIs, no matter where the Kubernetes `Scheduler` schedules your workload.
|
With Kubernetes `DaemonSet`, you can define applications that need to be deployed once per node in the cluster. This enables applications that are running on the same node to communicate with local Dapr APIs, no matter where the Kubernetes `Scheduler` schedules your workload.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,8 @@ The table below shows the versions of Dapr releases that have been tested togeth
|
||||||
|
|
||||||
| Release date | Runtime | CLI | SDKs | Dashboard | Status | Release notes |
|
| Release date | Runtime | CLI | SDKs | Dashboard | Status | Release notes |
|
||||||
|--------------------|:--------:|:--------|---------|---------|---------|------------|
|
|--------------------|:--------:|:--------|---------|---------|---------|------------|
|
||||||
|
| April 4th 2025 | 1.15.4</br> | 1.15.0 | Java 1.14.0 </br>Go 1.12.0 </br>PHP 1.2.0 </br>Python 1.15.0 </br>.NET 1.15.4 </br>JS 3.5.2 </br>Rust 0.16.1 | 0.15.0 | Supported (current) | [v1.15.4 release notes](https://github.com/dapr/dapr/releases/tag/v1.15.4) |
|
||||||
|
| March 5rd 2025 | 1.15.3</br> | 1.15.0 | Java 1.14.0 </br>Go 1.12.0 </br>PHP 1.2.0 </br>Python 1.15.0 </br>.NET 1.15.4 </br>JS 3.5.2 </br>Rust 0.16.1 | 0.15.0 | Supported (current) | [v1.15.3 release notes](https://github.com/dapr/dapr/releases/tag/v1.15.3) |
|
||||||
| March 3rd 2025 | 1.15.2</br> | 1.15.0 | Java 1.14.0 </br>Go 1.12.0 </br>PHP 1.2.0 </br>Python 1.15.0 </br>.NET 1.15.0 </br>JS 3.5.0 </br>Rust 0.16 | 0.15.0 | Supported (current) | [v1.15.2 release notes](https://github.com/dapr/dapr/releases/tag/v1.15.2) |
|
| March 3rd 2025 | 1.15.2</br> | 1.15.0 | Java 1.14.0 </br>Go 1.12.0 </br>PHP 1.2.0 </br>Python 1.15.0 </br>.NET 1.15.0 </br>JS 3.5.0 </br>Rust 0.16 | 0.15.0 | Supported (current) | [v1.15.2 release notes](https://github.com/dapr/dapr/releases/tag/v1.15.2) |
|
||||||
| February 28th 2025 | 1.15.1</br> | 1.15.0 | Java 1.14.0 </br>Go 1.12.0 </br>PHP 1.2.0 </br>Python 1.15.0 </br>.NET 1.15.0 </br>JS 3.5.0 </br>Rust 0.16 | 0.15.0 | Supported (current) | [v1.15.1 release notes](https://github.com/dapr/dapr/releases/tag/v1.15.1) |
|
| February 28th 2025 | 1.15.1</br> | 1.15.0 | Java 1.14.0 </br>Go 1.12.0 </br>PHP 1.2.0 </br>Python 1.15.0 </br>.NET 1.15.0 </br>JS 3.5.0 </br>Rust 0.16 | 0.15.0 | Supported (current) | [v1.15.1 release notes](https://github.com/dapr/dapr/releases/tag/v1.15.1) |
|
||||||
| February 27th 2025 | 1.15.0</br> | 1.15.0 | Java 1.14.0 </br>Go 1.12.0 </br>PHP 1.2.0 </br>Python 1.15.0 </br>.NET 1.15.0 </br>JS 3.5.0 </br>Rust 0.16 | 0.15.0 | Supported | [v1.15.0 release notes](https://github.com/dapr/dapr/releases/tag/v1.15.0) |
|
| February 27th 2025 | 1.15.0</br> | 1.15.0 | Java 1.14.0 </br>Go 1.12.0 </br>PHP 1.2.0 </br>Python 1.15.0 </br>.NET 1.15.0 </br>JS 3.5.0 </br>Rust 0.16 | 0.15.0 | Supported | [v1.15.0 release notes](https://github.com/dapr/dapr/releases/tag/v1.15.0) |
|
||||||
|
|
|
||||||
|
|
@ -170,15 +170,16 @@ To perform a create operation, invoke the AWS S3 binding with a `POST` method an
|
||||||
"operation": "create",
|
"operation": "create",
|
||||||
"data": "YOUR_CONTENT",
|
"data": "YOUR_CONTENT",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"storageClass": "STANDARD_IA"
|
"storageClass": "STANDARD_IA",
|
||||||
|
"tags": "project=sashimi,year=2024",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
For example you can provide a storage class while using the `create` operation with a Linux curl command
|
For example you can provide a storage class or tags while using the `create` operation with a Linux curl command
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -d '{ "operation": "create", "data": "YOUR_BASE_64_CONTENT", "metadata": { "storageClass": "STANDARD_IA" } }' /
|
curl -d '{ "operation": "create", "data": "YOUR_BASE_64_CONTENT", "metadata": { "storageClass": "STANDARD_IA", "project=sashimi,year=2024" } }' /
|
||||||
http://localhost:<dapr-port>/v1.0/bindings/<binding-name>
|
http://localhost:<dapr-port>/v1.0/bindings/<binding-name>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,7 @@ The above example uses secrets as plain strings. It is recommended to use a secr
|
||||||
| failover | N | Property to enabled failover configuration. Needs sentinalMasterName to be set. Defaults to `"false"` | `"true"`, `"false"`
|
| failover | N | Property to enabled failover configuration. Needs sentinalMasterName to be set. Defaults to `"false"` | `"true"`, `"false"`
|
||||||
| sentinelMasterName | N | The sentinel master name. See [Redis Sentinel Documentation](https://redis.io/docs/manual/sentinel/) | `""`, `"127.0.0.1:6379"`
|
| sentinelMasterName | N | The sentinel master name. See [Redis Sentinel Documentation](https://redis.io/docs/manual/sentinel/) | `""`, `"127.0.0.1:6379"`
|
||||||
| maxLenApprox | N | Maximum number of items inside a stream.The old entries are automatically evicted when the specified length is reached, so that the stream is left at a constant size. Defaults to unlimited. | `"10000"`
|
| maxLenApprox | N | Maximum number of items inside a stream.The old entries are automatically evicted when the specified length is reached, so that the stream is left at a constant size. Defaults to unlimited. | `"10000"`
|
||||||
|
| streamTTL | N | TTL duration for stream entries. Entries older than this duration will be evicted. This is an approximate value, as it's implemented using Redis stream's `MINID` trimming with the '~' modifier. The actual retention may include slightly more entries than strictly defined by the TTL, as Redis optimizes the trimming operation for efficiency by potentially keeping some additional entries. | `"30d"`
|
||||||
|
|
||||||
## Create a Redis instance
|
## Create a Redis instance
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Reference in New Issue