You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: samples/azure/azure-table/transactions/sample.md
+12-10Lines changed: 12 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,13 @@
1
1
---
2
-
title: Azure Table Persistence Usage with transactions
2
+
title: Azure Table Persistence Usage with Transactions
3
3
summary: Using Azure Table Persistence to store sagas and outbox records atomically
4
-
reviewed: 2022-11-17
4
+
reviewed: 2025-03-06
5
5
component: ASP
6
6
related:
7
7
- nservicebus/sagas
8
8
---
9
9
10
-
This sample shows a client/server scenario using saga and outbox persistences to store records atomically by leveraging transactions.
10
+
This sample demonstrates a client/server scenario using sagas and outbox persistences to store records atomically by leveraging transactions.
11
11
12
12
## Projects
13
13
@@ -25,31 +25,33 @@ The shared message contracts used by all endpoints.
25
25
* Receive the `StartOrder` message and initiate an `OrderSaga`.
26
26
*`OrderSaga` requests a timeout with an instance of `CompleteOrder` with the saga data.
27
27
* Receive the `OrderShipped` message with a custom header.
28
-
*`OrderSaga` publishes an `OrderCompleted` event when the `CompleteOrder` timeout fires.
28
+
*`OrderSaga` publishes an `OrderCompleted` event when the `CompleteOrder` timeout is triggered.
29
29
30
30
### Persistence config
31
31
32
32
Configure the endpoint to use Azure Table Persistence.
33
33
34
34
snippet: AzureTableConfig
35
35
36
-
The order id is used as a partition key.
36
+
The OrderId is used as the partition key.
37
37
38
-
## Behaviors
38
+
## Using Behaviors
39
39
40
-
Most messages implement `IProvideOrderId` and thus a logical behavior can use the provided order identification as a partition key.
40
+
The following shows two different ways to provide OrderIDs to the saga using [behaviors](/nservicebus/pipeline/manipulate-with-behaviors.md).
41
+
42
+
1. Most messages implement `IProvideOrderId` allowing the OrderId to be used as the partition key.
41
43
42
44
snippet: BehaviorUsingIProvideOrderId
43
45
44
-
One handler publishes an event that doesn't implement `IProvideOrderId` but adds a custom header to indicate the order identification. The handler also creates `OrderShippingInformation`by participating in the transactional batch provided by NServiceBus.
46
+
2.One handler publishes an event that does not implement `IProvideOrderId` but adds a custom header containing the OrderId. The handler also creates `OrderShippingInformation`as part of the transactional batch provided by NServiceBus.
45
47
46
48
snippet: UseHeader
47
49
48
-
The header can be used to determine the partition key in the transport receive context
50
+
The custom header added then allows the partition key to be determined within `OrderIdHeaderAsPartitionKeyBehavior`.
49
51
50
52
snippet: BehaviorUsingHeader
51
53
52
-
Finally the above behaviors are registered in the pipeline.
54
+
Finally, the above behaviors are registered in the pipeline.
0 commit comments