mirror of https://github.com/dapr/docs.git
Merge branch 'v1.15' into input-binding-net-example-update
This commit is contained in:
commit
8455f224bf
|
|
@ -18,4 +18,4 @@ jobs:
|
|||
stale-pr-message: 'Stale PR, paging all reviewers'
|
||||
stale-pr-label: 'stale'
|
||||
exempt-pr-labels: 'question,"help wanted",do-not-merge,waiting-on-code-pr'
|
||||
days-before-stale: 30
|
||||
days-before-stale: 90
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ Configure your application to receive incoming events. If you're using HTTP, you
|
|||
- Listen on a `POST` endpoint with the name of the binding, as specified in `metadata.name` in the `binding.yaml` file.
|
||||
- Verify your application allows Dapr to make an `OPTIONS` request for this endpoint.
|
||||
|
||||
Below are code examples that leverage Dapr SDKs to demonstrate an output binding.
|
||||
Below are code examples that leverage Dapr SDKs to demonstrate an input binding.
|
||||
|
||||
{{< tabs ".NET" Java Python Go JavaScript>}}
|
||||
|
||||
|
|
|
|||
|
|
@ -76,27 +76,21 @@ The following example shows how to get a saved configuration item using the Dapr
|
|||
{{% codetab %}}
|
||||
|
||||
```csharp
|
||||
//dependencies
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Dapr.Client;
|
||||
|
||||
//code
|
||||
namespace ConfigurationApi
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
private static readonly string CONFIG_STORE_NAME = "configstore";
|
||||
const string CONFIG_STORE_NAME = "configstore";
|
||||
|
||||
public static async Task Main(string[] args)
|
||||
{
|
||||
using var client = new DaprClientBuilder().Build();
|
||||
var configuration = await client.GetConfiguration(CONFIG_STORE_NAME, new List<string>() { "orderId1", "orderId2" });
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Services.AddDaprClient();
|
||||
var app = builder.Build();
|
||||
|
||||
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}");
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
{{% /codetab %}}
|
||||
|
|
@ -261,13 +255,19 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Dapr.Client;
|
||||
using System.Text.Json;
|
||||
|
||||
const string DAPR_CONFIGURATION_STORE = "configstore";
|
||||
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
|
||||
SubscribeConfigurationResponse subscribe = await client.SubscribeConfiguration(DAPR_CONFIGURATION_STORE, CONFIGURATION_ITEMS);
|
||||
var subscribe = await client.SubscribeConfiguration(DAPR_CONFIGURATION_STORE, CONFIGURATION_ITEMS);
|
||||
|
||||
// Print configuration changes
|
||||
await foreach (var items in subscribe.Source)
|
||||
|
|
@ -279,7 +279,7 @@ await foreach (var items in subscribe.Source)
|
|||
subscriptionId = subscribe.Id;
|
||||
continue;
|
||||
}
|
||||
var cfg = System.Text.Json.JsonSerializer.Serialize(items);
|
||||
var cfg = JsonSerializer.Serialize(items);
|
||||
Console.WriteLine("Configuration update " + cfg);
|
||||
}
|
||||
```
|
||||
|
|
@ -303,40 +303,23 @@ using Dapr.Extensions.Configuration;
|
|||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
namespace ConfigurationApi
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Starting application.");
|
||||
CreateHostBuilder(args).Build().Run();
|
||||
Console.WriteLine("Closing application.");
|
||||
}
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
/// <summary>
|
||||
/// Creates WebHost Builder.
|
||||
/// </summary>
|
||||
/// <param name="args">Arguments.</param>
|
||||
/// <returns>Returns IHostbuilder.</returns>
|
||||
public static IHostBuilder CreateHostBuilder(string[] args)
|
||||
{
|
||||
// Unlike most other situations, we build a `DaprClient` here using its factory because we cannot rely on `IConfiguration`
|
||||
// or other injected services to configure it because we haven't yet built the DI container.
|
||||
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));
|
||||
|
||||
})
|
||||
.ConfigureWebHostDefaults(webBuilder =>
|
||||
{
|
||||
webBuilder.UseStartup<Startup>();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
// In a real-world application, you'd also add the following line to register the `DaprClient` with the DI container so
|
||||
// it can be injected into other services. In this demonstration, it's not necessary as we're not injecting it anywhere.
|
||||
// builder.Services.AddDaprClient();
|
||||
|
||||
// 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:
|
||||
|
|
@ -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)">}}
|
||||
|
||||
{{% codetab %}}
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Dapr.Client;
|
||||
|
||||
const string DAPR_CONFIGURATION_STORE = "configstore";
|
||||
var client = new DaprClientBuilder().Build();
|
||||
var builder = WebApplication.CreateBuilder();
|
||||
builder.Services.AddDaprClient();
|
||||
var app = builder.Build();
|
||||
|
||||
// Unsubscribe to config updates and exit the app
|
||||
async Task unsubscribe(string subscriptionId)
|
||||
{
|
||||
try
|
||||
{
|
||||
await client.UnsubscribeConfiguration(DAPR_CONFIGURATION_STORE, subscriptionId);
|
||||
const string DAPR_CONFIGURATION_STORE = "configstore";
|
||||
const string SubscriptionId = "abc123"; //Replace with the subscription identifier to unsubscribe from
|
||||
var client = app.Services.GetRequiredService<DaprClient>();
|
||||
|
||||
await client.UnsubscribeConfiguration(DAPR_CONFIGURATION_STORE, SubscriptionId);
|
||||
Console.WriteLine("App unsubscribed from config changes");
|
||||
Environment.Exit(0);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Error unsubscribing from config updates: " + ex.Message);
|
||||
}
|
||||
}
|
||||
```
|
||||
{{% /codetab %}}
|
||||
|
||||
|
|
|
|||
|
|
@ -76,32 +76,25 @@ Now that you've set up the local secret store, call Dapr to get the secrets from
|
|||
{{% codetab %}}
|
||||
|
||||
```csharp
|
||||
//dependencies
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
using Dapr.Client;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Threading;
|
||||
using System.Text.Json;
|
||||
|
||||
//code
|
||||
namespace EventService
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static async Task Main(string[] args)
|
||||
{
|
||||
string SECRET_STORE_NAME = "localsecretstore";
|
||||
using var client = new DaprClientBuilder().Build();
|
||||
//Using Dapr SDK to get a secret
|
||||
var secret = await client.GetSecretAsync(SECRET_STORE_NAME, "secret");
|
||||
namespace EventService;
|
||||
|
||||
const string SECRET_STORE_NAME = "localsecretstore";
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Services.AddDaprClient();
|
||||
var app = builder.Build();
|
||||
|
||||
//Resolve a DaprClient from DI
|
||||
var daprClient = app.Services.GetRequiredService<DaprClient>();
|
||||
|
||||
//Use the Dapr SDK to get a secret
|
||||
var secret = await daprClient.GetSecretAsync(SECRET_STORE_NAME, "secret");
|
||||
|
||||
Console.WriteLine($"Result: {string.Join(", ", secret)}");
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
{{% /codetab %}}
|
||||
|
|
|
|||
|
|
@ -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).
|
||||
|
|
@ -8,16 +8,40 @@ aliases:
|
|||
- '/developing-applications/sdks/serialization/'
|
||||
---
|
||||
|
||||
An SDK for Dapr should provide serialization for two use cases. First, for API objects sent through request and response payloads. Second, for objects to be persisted. For both these use cases, a default serialization is provided. In the Java SDK, it is the [DefaultObjectSerializer](https://dapr.github.io/java-sdk/io/dapr/serializer/DefaultObjectSerializer.html) class, providing JSON serialization.
|
||||
Dapr SDKs provide serialization for two use cases. First, for API objects sent through request and response payloads. Second, for objects to be persisted. For both of these cases, a default serialization method is provided in each language SDK.
|
||||
|
||||
| Language SDK | Default Serializer |
|
||||
|------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| [.NET]({{< ref dotnet >}}) | [DataContracts](https://learn.microsoft.com/dotnet/framework/wcf/feature-details/using-data-contracts) for remoted actors, [System.Text.Json](https://www.nuget.org/packages/System.Text.Json) otherwise. Read more about .NET serialization [here]({{< ref dotnet-actors-serialization >}}) | |
|
||||
| [Java]({{< ref java >}}) | [DefaultObjectSerializer](https://dapr.github.io/java-sdk/io/dapr/serializer/DefaultObjectSerializer.html) for JSON serialization |
|
||||
| [JavaScript]({{< ref js >}}) | JSON |
|
||||
|
||||
## Service invocation
|
||||
|
||||
```java
|
||||
DaprClient client = (new DaprClientBuilder()).build();
|
||||
client.invokeService("myappid", "saySomething", "My Message", HttpExtension.POST).block();
|
||||
{{< tabs ".NET" "Java" >}}
|
||||
|
||||
<!-- .NET -->
|
||||
{{% codetab %}}
|
||||
|
||||
```csharp
|
||||
using var client = (new DaprClientBuilder()).Build();
|
||||
await client.InvokeMethodAsync("myappid", "saySomething", "My Message");
|
||||
```
|
||||
|
||||
In the example above, the app will receive a `POST` request for the `saySomething` method with the request payload as `"My Message"` - quoted since the serializer will serialize the input String to JSON.
|
||||
{{% /codetab %}}
|
||||
|
||||
<!-- Java -->
|
||||
{{% codetab %}}
|
||||
|
||||
```java
|
||||
DaprClient client = (new DaprClientBuilder()).build();
|
||||
client.invokeMethod("myappid", "saySomething", "My Message", HttpExtension.POST).block();
|
||||
```
|
||||
|
||||
{{% /codetab %}}
|
||||
|
||||
In the example above, the app `myappid` receives a `POST` request for the `saySomething` method with the request payload as
|
||||
`"My Message"` - quoted since the serializer will serialize the input String to JSON.
|
||||
|
||||
```text
|
||||
POST /saySomething HTTP/1.1
|
||||
|
|
@ -30,11 +54,35 @@ Content-Length: 12
|
|||
|
||||
## State management
|
||||
|
||||
{{< tabs ".NET" "Java" >}}
|
||||
|
||||
<!-- .NET -->
|
||||
{{% codetab %}}
|
||||
|
||||
```csharp
|
||||
using var client = (new DaprClientBuilder()).Build();
|
||||
var state = new Dictionary<string, string>
|
||||
{
|
||||
{ "key": "MyKey" },
|
||||
{ "value": "My Message" }
|
||||
};
|
||||
await client.SaveStateAsync("MyStateStore", "MyKey", state);
|
||||
```
|
||||
|
||||
{{% /codetab %}}
|
||||
|
||||
<!-- Java -->
|
||||
{{% codetab %}}
|
||||
|
||||
```java
|
||||
DaprClient client = (new DaprClientBuilder()).build();
|
||||
client.saveState("MyStateStore", "MyKey", "My Message").block();
|
||||
```
|
||||
In this example, `My Message` will be saved. It is not quoted because Dapr's API will internally parse the JSON request object before saving it.
|
||||
|
||||
{{% /codetab %}}
|
||||
|
||||
In this example, `My Message` is saved. It is not quoted because Dapr's API internally parse the JSON request
|
||||
object before saving it.
|
||||
|
||||
```JSON
|
||||
[
|
||||
|
|
@ -47,12 +95,45 @@ In this example, `My Message` will be saved. It is not quoted because Dapr's API
|
|||
|
||||
## PubSub
|
||||
|
||||
{{< tabs ".NET" "Java" >}}
|
||||
|
||||
<!-- .NET -->
|
||||
{{% codetab %}}
|
||||
|
||||
```csharp
|
||||
using var client = (new DaprClientBuilder()).Build();
|
||||
await client.PublishEventAsync("MyPubSubName", "TopicName", "My Message");
|
||||
```
|
||||
|
||||
The event is published and the content is serialized to `byte[]` and sent to Dapr sidecar. The subscriber receives it as a [CloudEvent](https://github.com/cloudevents/spec). Cloud event defines `data` as String. The Dapr SDK also provides a built-in deserializer for `CloudEvent` object.
|
||||
|
||||
```csharp
|
||||
public async Task<IActionResult> HandleMessage(string message)
|
||||
{
|
||||
//ASP.NET Core automatically deserializes the UTF-8 encoded bytes to a string
|
||||
return new Ok();
|
||||
}
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```csharp
|
||||
app.MapPost("/TopicName", [Topic("MyPubSubName", "TopicName")] (string message) => {
|
||||
return Results.Ok();
|
||||
}
|
||||
```
|
||||
|
||||
{{% /codetab %}}
|
||||
|
||||
<!-- Java -->
|
||||
{{% codetab %}}
|
||||
|
||||
```java
|
||||
DaprClient client = (new DaprClientBuilder()).build();
|
||||
client.publishEvent("TopicName", "My Message").block();
|
||||
```
|
||||
|
||||
The event is published and the content is serialized to `byte[]` and sent to Dapr sidecar. The subscriber will receive it as a [CloudEvent](https://github.com/cloudevents/spec). Cloud event defines `data` as String. Dapr SDK also provides a built-in deserializer for `CloudEvent` object.
|
||||
The event is published and the content is serialized to `byte[]` and sent to Dapr sidecar. The subscriber receives it as a [CloudEvent](https://github.com/cloudevents/spec). Cloud event defines `data` as String. The Dapr SDK also provides a built-in deserializer for `CloudEvent` objects.
|
||||
|
||||
```java
|
||||
@PostMapping(path = "/TopicName")
|
||||
|
|
@ -62,9 +143,50 @@ The event is published and the content is serialized to `byte[]` and sent to Dap
|
|||
}
|
||||
```
|
||||
|
||||
{{% /codetab %}}
|
||||
|
||||
## Bindings
|
||||
|
||||
In this case, the object is serialized to `byte[]` as well and the input binding receives the raw `byte[]` as-is and deserializes it to the expected object type.
|
||||
For output bindings the object is serialized to `byte[]` whereas the input binding receives the raw `byte[]` as-is and deserializes it to the expected object type.
|
||||
|
||||
{{< tabs ".NET" "Java" >}}
|
||||
|
||||
<!-- .NET -->
|
||||
{{% codetab %}}
|
||||
|
||||
* Output binding:
|
||||
```csharp
|
||||
using var client = (new DaprClientBuilder()).Build();
|
||||
await client.InvokeBindingAsync("sample", "My Message");
|
||||
```
|
||||
|
||||
* Input binding (controllers):
|
||||
```csharp
|
||||
[ApiController]
|
||||
public class SampleController : ControllerBase
|
||||
{
|
||||
[HttpPost("propagate")]
|
||||
public ActionResult<string> GetValue([FromBody] int itemId)
|
||||
{
|
||||
Console.WriteLine($"Received message: {itemId}");
|
||||
return $"itemID:{itemId}";
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
* Input binding (minimal API):
|
||||
```csharp
|
||||
app.MapPost("value", ([FromBody] int itemId) =>
|
||||
{
|
||||
Console.WriteLine($"Received message: {itemId}");
|
||||
return ${itemID:{itemId}";
|
||||
});
|
||||
* ```
|
||||
|
||||
{{% /codetab %}}
|
||||
|
||||
<!-- Java -->
|
||||
{{% codetab %}}
|
||||
|
||||
* Output binding:
|
||||
```java
|
||||
|
|
@ -80,15 +202,49 @@ In this case, the object is serialized to `byte[]` as well and the input binding
|
|||
System.out.println(message);
|
||||
}
|
||||
```
|
||||
|
||||
{{% /codetab %}}
|
||||
|
||||
It should print:
|
||||
```
|
||||
My Message
|
||||
```
|
||||
|
||||
## Actor Method invocation
|
||||
Object serialization and deserialization for invocation of Actor's methods are same as for the service method invocation, the only difference is that the application does not need to deserialize the request or serialize the response since it is all done transparently by the SDK.
|
||||
Object serialization and deserialization for Actor method invocation are same as for the service method invocation,
|
||||
the only difference is that the application does not need to deserialize the request or serialize the response since it
|
||||
is all done transparently by the SDK.
|
||||
|
||||
For Actor's methods, the SDK only supports methods with zero or one parameter.
|
||||
For Actor methods, the SDK only supports methods with zero or one parameter.
|
||||
|
||||
{{< tabs ".NET" "Java" >}}
|
||||
|
||||
The .NET SDK supports two different serialization types based on whether you're using strongly-typed (DataContracts)
|
||||
or weakly-typed (DataContracts or System.Text.JSON) actor client. [This document]({{< ref dotnet-actors-serialization >}})
|
||||
can provide more information about the differences between each and additional considerations to keep in mind.
|
||||
|
||||
<!-- .NET -->
|
||||
{{% codetab %}}
|
||||
|
||||
* Invoking an Actor's method using the weakly-typed client and System.Text.JSON:
|
||||
```csharp
|
||||
var proxy = this.ProxyFactory.Create(ActorId.CreateRandom(), "DemoActor");
|
||||
await proxy.SayAsync("My message");
|
||||
```
|
||||
|
||||
* Implementing an Actor's method:
|
||||
```csharp
|
||||
public Task SayAsync(string message)
|
||||
{
|
||||
Console.WriteLine(message);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
```
|
||||
|
||||
{{% /codetab %}}
|
||||
|
||||
<!-- Java -->
|
||||
{{% codetab %}}
|
||||
|
||||
* Invoking an Actor's method:
|
||||
```java
|
||||
|
|
@ -105,13 +261,37 @@ public String say(String something) {
|
|||
return "OK";
|
||||
}
|
||||
```
|
||||
|
||||
{{% /codetab %}}
|
||||
|
||||
It should print:
|
||||
```
|
||||
My Message
|
||||
```
|
||||
|
||||
## Actor's state management
|
||||
Actors can also have state. In this case, the state manager will serialize and deserialize the objects using the state serializer and handle it transparently to the application.
|
||||
Actors can also have state. In this case, the state manager will serialize and deserialize the objects using the state
|
||||
serializer and handle it transparently to the application.
|
||||
|
||||
<!-- .NET -->
|
||||
{{% codetab %}}
|
||||
|
||||
```csharp
|
||||
public Task SayAsync(string message)
|
||||
{
|
||||
// Reads state from a key
|
||||
var previousMessage = await this.StateManager.GetStateAsync<string>("lastmessage");
|
||||
|
||||
// Sets the new state for the key after serializing it
|
||||
await this.StateManager.SetStateAsync("lastmessage", message);
|
||||
return previousMessage;
|
||||
}
|
||||
```
|
||||
|
||||
{{% /codetab %}}
|
||||
|
||||
<!-- Java -->
|
||||
{{% codetab %}}
|
||||
|
||||
```java
|
||||
public String actorMethod(String message) {
|
||||
|
|
@ -124,12 +304,17 @@ public String actorMethod(String message) {
|
|||
}
|
||||
```
|
||||
|
||||
{{% /codetab %}}
|
||||
|
||||
## Default serializer
|
||||
|
||||
The default serializer for Dapr is a JSON serializer with the following expectations:
|
||||
|
||||
1. Use of basic [JSON data types](https://www.w3schools.com/js/js_json_datatypes.asp) for cross-language and cross-platform compatibility: string, number, array, boolean, null and another JSON object. Every complex property type in application's serializable objects (DateTime, for example), should be represented as one of the JSON's basic types.
|
||||
2. Data persisted with the default serializer should be saved as JSON objects too, without extra quotes or encoding. The example below shows how a string and a JSON object would look like in a Redis store.
|
||||
1. Use of basic [JSON data types](https://www.w3schools.com/js/js_json_datatypes.asp) for cross-language and cross-platform compatibility: string, number, array,
|
||||
boolean, null and another JSON object. Every complex property type in application's serializable objects (DateTime,
|
||||
for example), should be represented as one of the JSON's basic types.
|
||||
2. Data persisted with the default serializer should be saved as JSON objects too, without extra quotes or encoding.
|
||||
The example below shows how a string and a JSON object would look like in a Redis store.
|
||||
```bash
|
||||
redis-cli MGET "ActorStateIT_StatefulActorService||StatefulActorTest||1581130928192||message
|
||||
"This is a message to be saved and retrieved."
|
||||
|
|
@ -140,7 +325,8 @@ redis-cli MGET "ActorStateIT_StatefulActorService||StatefulActorTest||1581130928
|
|||
```
|
||||
3. Custom serializers must serialize object to `byte[]`.
|
||||
4. Custom serializers must deserialize `byte[]` to object.
|
||||
5. When user provides a custom serializer, it should be transferred or persisted as `byte[]`. When persisting, also encode as Base64 string. This is done natively by most JSON libraries.
|
||||
5. When user provides a custom serializer, it should be transferred or persisted as `byte[]`. When persisting, also
|
||||
encode as Base64 string. This is done natively by most JSON libraries.
|
||||
```bash
|
||||
redis-cli MGET "ActorStateIT_StatefulActorService||StatefulActorTest||1581130928192||message
|
||||
"VGhpcyBpcyBhIG1lc3NhZ2UgdG8gYmUgc2F2ZWQgYW5kIHJldHJpZXZlZC4="
|
||||
|
|
@ -149,5 +335,3 @@ redis-cli MGET "ActorStateIT_StatefulActorService||StatefulActorTest||1581130928
|
|||
redis-cli MGET "ActorStateIT_StatefulActorService||StatefulActorTest||1581130928192||mydata
|
||||
"eyJ2YWx1ZSI6Ik15IGRhdGEgdmFsdWUuIn0="
|
||||
```
|
||||
|
||||
*As of now, the [Java SDK](https://github.com/dapr/java-sdk/) is the only Dapr SDK that implements this specification. In the near future, other SDKs will also implement the same.*
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ apps:
|
|||
|
||||
#### 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
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
|
|
@ -215,7 +215,7 @@ apps:
|
|||
|
||||
#### 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
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
|
|
@ -345,7 +345,7 @@ apps:
|
|||
|
||||
#### 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
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
|
|
@ -475,7 +475,7 @@ apps:
|
|||
|
||||
#### 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
|
||||
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).
|
||||
|
||||
```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.
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ spec:
|
|||
|
||||
## Deploy Dapr with Helm
|
||||
|
||||
[Visit the full guide on deploying Dapr with Helm]({{< ref "kubernetes-deploy.md#install-with-helm-advanced" >}}).
|
||||
[Visit the full guide on deploying Dapr with Helm]({{< ref "kubernetes-deploy.md#install-with-helm" >}}).
|
||||
|
||||
### Parameters file
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,6 @@ type: docs
|
|||
title: "Logging"
|
||||
linkTitle: "Logging"
|
||||
weight: 400
|
||||
description: "How to setup loggings for Dapr sidecar, and your application"
|
||||
description: "How to setup logging for Dapr sidecar, and your application"
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ If you are using the Azure Kubernetes Service, you can use [Azure Monitor for co
|
|||
|
||||
## References
|
||||
|
||||
- [How-to: Set up Fleuntd, Elastic search, and Kibana]({{< ref fluentd.md >}})
|
||||
- [How-to: Set up Fluentd, Elastic search, and Kibana]({{< ref fluentd.md >}})
|
||||
- [How-to: Set up Azure Monitor in Azure Kubernetes Service]({{< ref azure-monitor.md >}})
|
||||
- [Configure and view Dapr Logs]({{< ref "logs-troubleshooting.md" >}})
|
||||
- [Configure and view Dapr API Logs]({{< ref "api-logs-troubleshooting.md" >}})
|
||||
|
|
|
|||
|
|
@ -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 |
|
||||
|--------------------|:--------:|:--------|---------|---------|---------|------------|
|
||||
| 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) |
|
||||
| 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) |
|
||||
|
|
|
|||
|
|
@ -170,15 +170,16 @@ To perform a create operation, invoke the AWS S3 binding with a `POST` method an
|
|||
"operation": "create",
|
||||
"data": "YOUR_CONTENT",
|
||||
"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
|
||||
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>
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -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"`
|
||||
| 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"`
|
||||
| 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
|
||||
|
||||
|
|
|
|||
|
|
@ -88,6 +88,10 @@ For example, if installing using the example above, the Cassandra DNS would be:
|
|||
|
||||
{{< /tabs >}}
|
||||
|
||||
## Apache Ignite
|
||||
|
||||
[Apache Ignite](https://ignite.apache.org/)'s integration with Cassandra as a caching layer is not supported by this component.
|
||||
|
||||
## Related links
|
||||
- [Basic schema for a Dapr component]({{< ref component-schema >}})
|
||||
- Read [this guide]({{< ref "howto-get-save-state.md#step-2-save-and-retrieve-a-single-state" >}}) for instructions on configuring state store components
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in New Issue