example and 2x wrap clarification (#810)

Co-authored-by: Yaron Schneider <yaronsc@microsoft.com>
This commit is contained in:
Mark Chmarny 2020-09-24 15:18:25 -07:00 committed by GitHub
parent 2bb237893f
commit f6b7f0b3f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 1 deletions

View File

@ -25,7 +25,7 @@ When multiple instances of the same application ID subscribe to a topic, Dapr wi
## Cloud events
Dapr follows the [Cloud Events 1.0 Spec](https://github.com/cloudevents/spec/tree/v1.0) and wraps any payload sent to a topic inside a Cloud Events envelope.
Dapr follows the [CloudEvents 1.0 Spec](https://github.com/cloudevents/spec/tree/v1.0) and wraps any payload sent to a topic inside a Cloud Events envelope.
The following fields from the Cloud Events spec are implemented with Dapr:
@ -34,3 +34,22 @@ The following fields from the Cloud Events spec are implemented with Dapr:
* `specversion`
* `type`
* `datacontenttype` (Optional)
> Starting with Dapr v0.9, Dapr no longer wraps published content into CloudEvent if the published payload itself is already in CloudEvent format.
The following example shows an XML content in CloudEvent v1.0 serialized as JSON:
```json
{
"specversion" : "1.0",
"type" : "xml.message",
"source" : "https://example.com/message",
"subject" : "Test XML Message",
"id" : "id-1234-5678-9101",
"time" : "2020-09-23T06:23:21Z",
"datacontenttype" : "text/xml",
"data" : "<note><to>User1</to><from>user2</from><message>hi</message></note>"
}
```