mirror of https://github.com/dapr/docs.git
Update PubSub Raw doc (#4659)
* Update pubsub-raw.md Updating Raw PubSub doc to be more specific about content type and delivery details. Signed-off-by: Alice Gibbons <alice@diagrid.io> * Update daprdocs/content/en/developing-applications/building-blocks/pubsub/pubsub-raw.md Signed-off-by: Mark Fussell <markfussell@gmail.com> --------- Signed-off-by: Alice Gibbons <alice@diagrid.io> Signed-off-by: Mark Fussell <markfussell@gmail.com> Co-authored-by: Mark Fussell <markfussell@gmail.com>
This commit is contained in:
parent
46d200e751
commit
4638f8f3fa
|
@ -6,7 +6,7 @@ weight: 2200
|
|||
description: "Learn when you might not use CloudEvents and how to disable them."
|
||||
---
|
||||
|
||||
When adding Dapr to your application, some services may still need to communicate via pub/sub messages not encapsulated in CloudEvents, due to either compatibility reasons or some apps not using Dapr. These are referred to as "raw" pub/sub messages. Dapr enables apps to [publish and subscribe to raw events]({{< ref "pubsub-cloudevents.md#publishing-raw-messages" >}}) not wrapped in a CloudEvent for compatibility.
|
||||
When adding Dapr to your application, some services may still need to communicate via pub/sub messages not encapsulated in CloudEvents, due to either compatibility reasons or some apps not using Dapr. These are referred to as "raw" pub/sub messages. Dapr enables apps to [publish and subscribe to raw events]({{< ref "pubsub-cloudevents.md#publishing-raw-messages" >}}) not wrapped in a CloudEvent for compatibility and to send data that is not JSON serializable.
|
||||
|
||||
## Publishing raw messages
|
||||
|
||||
|
@ -105,13 +105,15 @@ $app->run(function(\DI\FactoryInterface $factory) {
|
|||
|
||||
## Subscribing to raw messages
|
||||
|
||||
Dapr apps are also able to subscribe to raw events coming from existing pub/sub topics that do not use CloudEvent encapsulation.
|
||||
Dapr apps can subscribe to raw messages from pub/sub topics, even if they weren’t published as CloudEvents. However, the subscribing Dapr process still wraps these raw messages in a CloudEvent before delivering them to the subscribing application.
|
||||
|
||||
<img src="/images/pubsub_subscribe_raw.png" alt="Diagram showing how to subscribe with Dapr when publisher does not use Dapr or CloudEvent" width=1000>
|
||||
|
||||
### Programmatically subscribe to raw events
|
||||
|
||||
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`.
|
||||
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`.
|
||||
|
||||
When using raw payloads the message is always base64 encoded with content type `application/octet-stream`.
|
||||
|
||||
{{< tabs ".NET" "Python" "PHP" >}}
|
||||
|
||||
|
@ -242,4 +244,4 @@ scopes:
|
|||
- Learn more about [publishing and subscribing messages]({{< ref pubsub-overview.md >}})
|
||||
- List of [pub/sub components]({{< ref supported-pubsub >}})
|
||||
- Read the [API reference]({{< ref pubsub_api.md >}})
|
||||
- Read the .NET sample on how to [consume Kafka messages without CloudEvents](https://github.com/dapr/samples/pubsub-raw-payload)
|
||||
- Read the .NET sample on how to [consume Kafka messages without CloudEvents](https://github.com/dapr/samples/pubsub-raw-payload)
|
||||
|
|
Loading…
Reference in New Issue