Skip to content

Commit

Permalink
Merge branch 'v1.15' into docs-scheduler-etcd-flags
Browse files Browse the repository at this point in the history
  • Loading branch information
hhunter-ms authored Feb 24, 2025
2 parents 576bd9a + 7307d8e commit 4727b7e
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,26 @@ with DaprClient() as client:
topic_name='orders',
publish_metadata={'cloudevent.id': 'd99b228f-6c73-4e78-8c4d-3f80a043d317', 'cloudevent.source': 'payment'}
)

# or

cloud_event = {
'specversion': '1.0',
'type': 'com.example.event',
'source': 'payment',
'id': 'd99b228f-6c73-4e78-8c4d-3f80a043d317',
'data': {'orderId': i},
'datacontenttype': 'application/json',
...
}

# Set the data content type to 'application/cloudevents+json'
result = client.publish_event(
pubsub_name='order_pub_sub',
topic_name='orders',
data=json.dumps(cloud_event),
data_content_type='application/cloudevents+json',
)
```

{{% /codetab %}}
Expand Down

0 comments on commit 4727b7e

Please sign in to comment.