From 5050dd5c946fe24dbfca3375db05db24553ac85f Mon Sep 17 00:00:00 2001 From: Bilgin Ibryam Date: Tue, 7 Oct 2025 15:57:58 +0100 Subject: [PATCH] Updated outbox doc to use correct sample for projection Signed-off-by: Bilgin Ibryam --- .../state-management/howto-outbox.md | 32 +++++++------------ 1 file changed, 12 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 40fc8719475..d674a67063f 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 @@ -181,28 +181,20 @@ DAPR_STORE_NAME = "statestore" async def main(): client = DaprClient() - # Define the first state operation to save the value "2" - op1 = StateItem( - key="key1", - value=b"2" + client.execute_state_transaction( + store_name=DAPR_STORE_NAME, + operations=[ + # Define the first state operation to save the value "2" + TransactionalStateOperation( + key='key1', data='2', metadata={'outbox.projection': 'false'} + ), + # Define the second state operation to publish the value "3" with metadata + TransactionalStateOperation( + key='key1', data='3', metadata={'outbox.projection': 'true'} + ), + ], ) - # Define the second state operation to publish the value "3" with metadata - op2 = StateItem( - key="key1", - value=b"3", - options=StateOptions( - metadata={ - "outbox.projection": "true" - } - ) - ) - - # Create the list of state operations - ops = [op1, op2] - - # Execute the state transaction - await client.state.transaction(DAPR_STORE_NAME, operations=ops) print("State transaction executed.") ```