From 9d44b86b8e59cc29e1d45d31811bbee256e1e4a0 Mon Sep 17 00:00:00 2001 From: yaron2 Date: Tue, 30 Jul 2024 20:56:10 -0700 Subject: [PATCH 1/3] fix outbox projection http json Signed-off-by: yaron2 --- .../state-management/howto-outbox.md | 47 +++++++++++-------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/daprdocs/content/en/developing-applications/building-blocks/state-management/howto-outbox.md b/daprdocs/content/en/developing-applications/building-blocks/state-management/howto-outbox.md index a2facf91bb3..a40342b58e9 100644 --- a/daprdocs/content/en/developing-applications/building-blocks/state-management/howto-outbox.md +++ b/daprdocs/content/en/developing-applications/building-blocks/state-management/howto-outbox.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`): From f583a2310309739fa8a39630c228963707997336 Mon Sep 17 00:00:00 2001 From: yaron2 Date: Tue, 30 Jul 2024 21:02:30 -0700 Subject: [PATCH 2/3] update outbox projection text Signed-off-by: yaron2 --- .../building-blocks/state-management/howto-outbox.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/daprdocs/content/en/developing-applications/building-blocks/state-management/howto-outbox.md b/daprdocs/content/en/developing-applications/building-blocks/state-management/howto-outbox.md index a40342b58e9..af7bc1ca193 100644 --- a/daprdocs/content/en/developing-applications/building-blocks/state-management/howto-outbox.md +++ b/daprdocs/content/en/developing-applications/building-blocks/state-management/howto-outbox.md @@ -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 will 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 will be ignored when the state is written and the data will be 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 >}}) From 0bf8ca4d9f99bf1563940eb4ccc82ab76e5cbb76 Mon Sep 17 00:00:00 2001 From: Mark Fussell Date: Wed, 31 Jul 2024 08:39:28 -0700 Subject: [PATCH 3/3] Update daprdocs/content/en/developing-applications/building-blocks/state-management/howto-outbox.md Signed-off-by: Mark Fussell --- .../building-blocks/state-management/howto-outbox.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daprdocs/content/en/developing-applications/building-blocks/state-management/howto-outbox.md b/daprdocs/content/en/developing-applications/building-blocks/state-management/howto-outbox.md index af7bc1ca193..40261a1afb0 100644 --- a/daprdocs/content/en/developing-applications/building-blocks/state-management/howto-outbox.md +++ b/daprdocs/content/en/developing-applications/building-blocks/state-management/howto-outbox.md @@ -110,7 +110,7 @@ spec: ### Shape the outbox pattern message -You can override the outbox pattern message published to the pub/sub broker by setting another transaction that will 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 will be ignored when the state is written and the data will be used as the payload sent to the upstream subscriber. +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 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.