This endpoint lets you publish a payload to multiple consumers who are listening on a topic
.
Dapr guarantees at least once semantics for this endpoint.
POST http://localhost:<daprPort>/v1.0/publish/<topic>
Code | Description |
---|---|
200 | Message delivered |
500 | Delivery failed |
Parameter | Description |
---|---|
daprPort | the Dapr port |
topic | the name of the topic |
curl -X POST http://localhost:3500/v1.0/publish/deathStarStatus \
-H "Content-Type: application/json" \
-d '{
"status": "completed"
}'
Dapr will invoke the following endpoint on user code to discover topic subscriptions:
GET http://localhost:<appPort>/dapr/subscribe
Parameter | Description |
---|---|
appPort | the application port |
A json encoded array of strings.
Example:
"["TopicA","TopicB"]"
In order to deliver topic events, a POST
call will be made to user code with the name of the topic as the URL path.
The following example illustrates this point, considering a subscription for topic TopicA
:
POST http://localhost:<appPort>/TopicA
Parameter | Description |
---|---|
appPort | the application port |
A JSON encoded payload.
Dapr Pub/Sub adheres to version 0.3 of Cloud Events.