Skip to content

Commit 2d973d6

Browse files
authored
Merge branch 'v1.14' into endgame_v1.14-updates
2 parents 7a5c3eb + 27683a6 commit 2d973d6

File tree

4 files changed

+97
-20
lines changed

4 files changed

+97
-20
lines changed

daprdocs/content/en/developing-applications/building-blocks/pubsub/pubsub-raw.md

+86-5
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,51 @@ Not using CloudEvents disables support for tracing, event deduplication per mess
2020

2121
To disable CloudEvent wrapping, set the `rawPayload` metadata to `true` as part of the publishing request. This allows subscribers to receive these messages without having to parse the CloudEvent schema.
2222

23-
{{< tabs curl "Python SDK" "PHP SDK">}}
23+
{{< tabs curl ".NET" "Python" "PHP">}}
2424

2525
{{% codetab %}}
2626
```bash
2727
curl -X "POST" http://localhost:3500/v1.0/publish/pubsub/TOPIC_A?metadata.rawPayload=true -H "Content-Type: application/json" -d '{"order-number": "345"}'
2828
```
2929
{{% /codetab %}}
3030

31+
{{% codetab %}}
32+
33+
```csharp
34+
using Dapr.Client;
35+
36+
var builder = WebApplication.CreateBuilder(args);
37+
builder.Services.AddControllers().AddDapr();
38+
39+
var app = builder.Build();
40+
41+
app.MapPost("/publish", async (DaprClient daprClient) =>
42+
{
43+
var message = new Message(
44+
Guid.NewGuid().ToString(),
45+
$"Hello at {DateTime.UtcNow}",
46+
DateTime.UtcNow
47+
);
48+
49+
await daprClient.PublishEventAsync(
50+
"pubsub", // pubsub name
51+
"messages", // topic name
52+
message, // message data
53+
new Dictionary<string, string>
54+
{
55+
{ "rawPayload", "true" },
56+
{ "content-type", "application/json" }
57+
}
58+
);
59+
60+
return Results.Ok(message);
61+
});
62+
63+
app.Run();
64+
```
65+
66+
{{% /codetab %}}
67+
3168
{{% codetab %}}
3269
```python
3370
from dapr.clients import DaprClient
@@ -74,9 +111,52 @@ Dapr apps are also able to subscribe to raw events coming from existing pub/sub
74111

75112
### Programmatically subscribe to raw events
76113

77-
When subscribing programmatically, add the additional metadata entry for `rawPayload` so the Dapr sidecar automatically wraps the payloads into a CloudEvent that is compatible with current Dapr SDKs.
114+
When subscribing programmatically, add the additional metadata entry for `rawPayload` to allow the subscriber to receive a message that is not wrapped by a CloudEvent. For .NET, this metadata entry is called `isRawPayload`.
115+
116+
{{< tabs ".NET" "Python" "PHP" >}}
117+
118+
{{% codetab %}}
119+
120+
```csharp
121+
using System.Text.Json;
122+
using System.Text.Json.Serialization;
123+
124+
var builder = WebApplication.CreateBuilder(args);
125+
var app = builder.Build();
126+
127+
app.MapGet("/dapr/subscribe", () =>
128+
{
129+
var subscriptions = new[]
130+
{
131+
new
132+
{
133+
pubsubname = "pubsub",
134+
topic = "messages",
135+
route = "/messages",
136+
metadata = new Dictionary<string, string>
137+
{
138+
{ "isRawPayload", "true" },
139+
{ "content-type", "application/json" }
140+
}
141+
}
142+
};
143+
return Results.Ok(subscriptions);
144+
});
145+
146+
app.MapPost("/messages", async (HttpContext context) =>
147+
{
148+
using var reader = new StreamReader(context.Request.Body);
149+
var json = await reader.ReadToEndAsync();
150+
151+
Console.WriteLine($"Raw message received: {json}");
78152

79-
{{< tabs "Python" "PHP SDK" >}}
153+
return Results.Ok();
154+
});
155+
156+
app.Run();
157+
```
158+
159+
{{% /codetab %}}
80160

81161
{{% codetab %}}
82162

@@ -151,7 +231,7 @@ spec:
151231
default: /dsstatus
152232
pubsubname: pubsub
153233
metadata:
154-
rawPayload: "true"
234+
isRawPayload: "true"
155235
scopes:
156236
- app1
157237
- app2
@@ -161,4 +241,5 @@ scopes:
161241
162242
- Learn more about [publishing and subscribing messages]({{< ref pubsub-overview.md >}})
163243
- List of [pub/sub components]({{< ref supported-pubsub >}})
164-
- Read the [API reference]({{< ref pubsub_api.md >}})
244+
- Read the [API reference]({{< ref pubsub_api.md >}})
245+
- Read the .NET sample on how to [consume Kafka messages without CloudEvents](https://github.com/dapr/samples/pubsub-raw-payload)

daprdocs/content/en/getting-started/quickstarts/serviceinvocation-quickstart.md

+8-12
Original file line numberDiff line numberDiff line change
@@ -439,13 +439,11 @@ app.MapPost("/orders", (Order order) =>
439439
In the Program.cs file for the `checkout` service, you'll notice there's no need to rewrite your app code to use Dapr's service invocation. You can enable service invocation by simply adding the `dapr-app-id` header, which specifies the ID of the target service.
440440

441441
```csharp
442-
var client = new HttpClient();
443-
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
442+
var client = DaprClient.CreateInvokeHttpClient(appId: "order-processor");
443+
var cts = new CancellationTokenSource();
444444
445-
client.DefaultRequestHeaders.Add("dapr-app-id", "order-processor");
446-
447-
var response = await client.PostAsync($"{baseURL}/orders", content);
448-
Console.WriteLine("Order passed: " + order);
445+
var response = await client.PostAsJsonAsync("/orders", order, cts.Token);
446+
Console.WriteLine("Order passed: " + order);
449447
```
450448

451449
{{% /codetab %}}
@@ -1089,13 +1087,11 @@ dapr run --app-id checkout --app-protocol http --dapr-http-port 3500 -- dotnet r
10891087
In the Program.cs file for the `checkout` service, you'll notice there's no need to rewrite your app code to use Dapr's service invocation. You can enable service invocation by simply adding the `dapr-app-id` header, which specifies the ID of the target service.
10901088

10911089
```csharp
1092-
var client = new HttpClient();
1093-
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
1094-
1095-
client.DefaultRequestHeaders.Add("dapr-app-id", "order-processor");
1090+
var client = DaprClient.CreateInvokeHttpClient(appId: "order-processor");
1091+
var cts = new CancellationTokenSource();
10961092

1097-
var response = await client.PostAsync($"{baseURL}/orders", content);
1098-
Console.WriteLine("Order passed: " + order);
1093+
var response = await client.PostAsJsonAsync("/orders", order, cts.Token);
1094+
Console.WriteLine("Order passed: " + order);
10991095
```
11001096

11011097
### Step 5: Use with Multi-App Run

daprdocs/content/en/operations/hosting/self-hosted/self-hosted-with-docker.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ services:
149149
- type: tmpfs
150150
target: /data
151151
tmpfs:
152-
size: "10000"
152+
size: "64m"
153153

154154
networks:
155155
hello-dapr: null

daprdocs/static/docs/open-telemetry-collector/open-telemetry-collector-jaeger.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ data:
1919
zpages:
2020
endpoint: :55679
2121
exporters:
22-
logging:
23-
loglevel: debug
22+
debug:
23+
verbosity: detailed
2424
# Depending on where you want to export your trace, use the
2525
# correct OpenTelemetry trace exporter here.
2626
#

0 commit comments

Comments
 (0)