mirror of https://github.com/dapr/docs.git
Fix outbox projection http json (#4286)
* fix outbox projection http json Signed-off-by: yaron2 <schneider.yaron@live.com> * update outbox projection text Signed-off-by: yaron2 <schneider.yaron@live.com> * Update daprdocs/content/en/developing-applications/building-blocks/state-management/howto-outbox.md Signed-off-by: Mark Fussell <markfussell@gmail.com> --------- Signed-off-by: yaron2 <schneider.yaron@live.com> Signed-off-by: Mark Fussell <markfussell@gmail.com> Co-authored-by: Mark Fussell <markfussell@gmail.com>
This commit is contained in:
parent
dce14481be
commit
7e4b80185b
|
@ -110,11 +110,11 @@ spec:
|
|||
|
||||
### Shape the outbox pattern message
|
||||
|
||||
You can override the outbox pattern message published to the pub/sub broker by setting a different message. This is done via a projected transaction payload, called `outboxProjections`, which is ignored when the state is written and is used as the outbox pattern message published to the user topic.
|
||||
You can override the outbox pattern message published to the pub/sub broker by setting another transaction that is not be saved to the database and is explicitly mentioned as a projection. This transaction is added a metadata key named `outbox.projection` with a value set to `true`. When added to the state array saved in a transaction, this payload is ignored when the state is written and the data is used as the payload sent to the upstream subscriber.
|
||||
|
||||
To set the `outboxProjections` to `true`, the `key` values must match between the operation on the state store and the message projection. If the keys do not match, the whole transaction fails.
|
||||
To use correctly, the `key` values must match between the operation on the state store and the message projection. If the keys do not match, the whole transaction fails.
|
||||
|
||||
If you have two or more `outboxProjections` for the same key, the first one defined is used and the others are ignored.
|
||||
If you have two or more `outbox.projection` enabled state items for the same key, the first one defined is used and the others are ignored.
|
||||
|
||||
[Learn more about default and custom CloudEvent messages.]({{< ref pubsub-cloudevents.md >}})
|
||||
|
||||
|
@ -368,26 +368,33 @@ You can pass the message override using the following HTTP request:
|
|||
curl -X POST http://localhost:3500/v1.0/state/starwars/transaction \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"operations": [
|
||||
{
|
||||
"operation": "upsert",
|
||||
"request": {
|
||||
"key": "key1",
|
||||
"value": "2"
|
||||
}
|
||||
},
|
||||
{
|
||||
"operation": "upsert",
|
||||
"request": {
|
||||
"key": "key1"
|
||||
"value: "3"
|
||||
"metadata": {
|
||||
"outboxProjection": "true"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
}'
|
||||
"operations": [
|
||||
{
|
||||
"operation": "upsert",
|
||||
"request": {
|
||||
"key": "order1",
|
||||
"value": {
|
||||
"orderId": "7hf8374s",
|
||||
"type": "book",
|
||||
"name": "The name of the wind"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"operation": "upsert",
|
||||
"request": {
|
||||
"key": "order1",
|
||||
"value": {
|
||||
"orderId": "7hf8374s"
|
||||
},
|
||||
"metadata": {
|
||||
"outbox.projection": "true"
|
||||
},
|
||||
"contentType": "application/json"
|
||||
}
|
||||
}
|
||||
]
|
||||
}'
|
||||
```
|
||||
|
||||
By setting the metadata item `"outbox.projection"` to `"true"` and making sure the `key` values match (`key1`):
|
||||
|
|
Loading…
Reference in New Issue