File tree Expand file tree Collapse file tree 4 files changed +11
-16
lines changed
OrderService/OrderService Expand file tree Collapse file tree 4 files changed +11
-16
lines changed Original file line number Diff line number Diff line change 3
3
namespace OrderService
4
4
{
5
5
public class EndpointConfig : IConfigureThisEndpoint , AsA_Publisher { }
6
-
7
- public class TimeoutConfiguration : IWantCustomInitialization
8
- {
9
- public void Init ( )
10
- {
11
- Configure . Instance . RunTimeoutManager ( ) ;
12
- }
13
- }
14
6
}
Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ public class OrderSagaData : IContainSagaData
9
9
public virtual Guid Id { get ; set ; }
10
10
public virtual string Originator { get ; set ; }
11
11
public virtual string OriginalMessageId { get ; set ; }
12
+
13
+ [ Unique ]
12
14
public virtual string PurchaseOrderNumber { get ; set ; }
13
15
public virtual Guid PartnerId { get ; set ; }
14
16
public virtual DateTime ProvideBy { get ; set ; }
Original file line number Diff line number Diff line change @@ -80,24 +80,25 @@ static void Main()
80
80
private static void Simulate ( IBus bus , bool step )
81
81
{
82
82
Guid partnerId = Guid . NewGuid ( ) ;
83
- int numberOfLines ;
83
+ int numberOfOrders ;
84
84
int secondsToProvideBy ;
85
85
86
86
while ( true )
87
87
{
88
- Random r = new Random ( ) ;
88
+ var r = new Random ( ) ;
89
89
90
- numberOfLines = 5 + r . Next ( 0 , 5 ) ;
90
+ numberOfOrders = 5 + r . Next ( 0 , 5 ) ;
91
91
secondsToProvideBy = 10 + r . Next ( 0 , 10 ) ;
92
- string purchaseOrderNumber = Guid . NewGuid ( ) . ToString ( ) ;
93
-
94
- for ( int i = 0 ; i < numberOfLines ; i ++ )
95
- {
92
+
93
+ for ( var i = 0 ; i < numberOfOrders ; i ++ )
94
+ {
95
+ var purchaseOrderNumber = Guid . NewGuid ( ) . ToString ( ) ;
96
+
96
97
bus . Send < IOrderMessage > ( m =>
97
98
{
98
99
m . PurchaseOrderNumber = purchaseOrderNumber ;
99
100
m . PartnerId = partnerId ;
100
- m . Done = ( i == numberOfLines - 1 ) ;
101
+ m . Done = true ;
101
102
m . ProvideBy = DateTime . UtcNow + TimeSpan . FromSeconds ( secondsToProvideBy ) ;
102
103
m . OrderLines = new List < IOrderLine > {
103
104
bus . CreateInstance < IOrderLine > ( ol => {
You can’t perform that action at this time.
0 commit comments