mirror of https://github.com/dapr/docs.git
removing unecessary lines of code and moddifying verbiage around raw message subscriptions
Signed-off-by: Fernando Rocha <fernando@diagrid.io>
This commit is contained in:
parent
e98d40fd23
commit
9ad76c3c05
|
@ -32,15 +32,12 @@ curl -X "POST" http://localhost:3500/v1.0/publish/pubsub/TOPIC_A?metadata.rawPay
|
|||
|
||||
```csharp
|
||||
using Dapr.Client;
|
||||
using Shared;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Services.AddControllers().AddDapr();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
app.MapGet("/", () => "Publisher API");
|
||||
|
||||
app.MapPost("/publish", async (DaprClient daprClient) =>
|
||||
{
|
||||
var message = new Message(
|
||||
|
@ -114,7 +111,7 @@ Dapr apps are also able to subscribe to raw events coming from existing pub/sub
|
|||
|
||||
### Programmatically subscribe to raw events
|
||||
|
||||
When subscribing programmatically, add the additional metadata entry for `rawPayload` - `isRawPayload` on .NET - so the Dapr sidecar automatically wraps the payloads into a CloudEvent that is compatible with current Dapr SDKs.
|
||||
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`.
|
||||
|
||||
{{< tabs ".NET" "Python" "PHP" >}}
|
||||
|
||||
|
@ -124,12 +121,9 @@ When subscribing programmatically, add the additional metadata entry for `rawPay
|
|||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
var app = builder.Build();
|
||||
|
||||
app.MapGet("/", () => "Subscriber API");
|
||||
|
||||
app.MapGet("/dapr/subscribe", () =>
|
||||
{
|
||||
var subscriptions = new[]
|
||||
|
@ -141,7 +135,8 @@ app.MapGet("/dapr/subscribe", () =>
|
|||
route = "/messages",
|
||||
metadata = new Dictionary<string, string>
|
||||
{
|
||||
{ "isRawPayload", "true" }
|
||||
{ "isRawPayload", "true" },
|
||||
{ "content-type", "application/json" }
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue