Skip to content

Commit a388998

Browse files
bibryammsfussell
andauthored
Updated outbox doc to use correct sample for projection (#4913)
Signed-off-by: Bilgin Ibryam <[email protected]> Co-authored-by: Mark Fussell <[email protected]>
1 parent 318333f commit a388998

File tree

1 file changed

+12
-20
lines changed
  • daprdocs/content/en/developing-applications/building-blocks/state-management

1 file changed

+12
-20
lines changed

daprdocs/content/en/developing-applications/building-blocks/state-management/howto-outbox.md

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -181,28 +181,20 @@ DAPR_STORE_NAME = "statestore"
181181
async def main():
182182
client = DaprClient()
183183
184-
# Define the first state operation to save the value "2"
185-
op1 = StateItem(
186-
key="key1",
187-
value=b"2"
184+
client.execute_state_transaction(
185+
store_name=DAPR_STORE_NAME,
186+
operations=[
187+
# Define the first state operation to save the value "2"
188+
TransactionalStateOperation(
189+
key='key1', data='2', metadata={'outbox.projection': 'false'}
190+
),
191+
# Define the second state operation to publish the value "3" with metadata
192+
TransactionalStateOperation(
193+
key='key1', data='3', metadata={'outbox.projection': 'true'}
194+
),
195+
],
188196
)
189197
190-
# Define the second state operation to publish the value "3" with metadata
191-
op2 = StateItem(
192-
key="key1",
193-
value=b"3",
194-
options=StateOptions(
195-
metadata={
196-
"outbox.projection": "true"
197-
}
198-
)
199-
)
200-
201-
# Create the list of state operations
202-
ops = [op1, op2]
203-
204-
# Execute the state transaction
205-
await client.state.transaction(DAPR_STORE_NAME, operations=ops)
206198
print("State transaction executed.")
207199
```
208200

0 commit comments

Comments
 (0)