From 9a325c7da500681948ba06c9f5bb8e9ec30dbecd Mon Sep 17 00:00:00 2001 From: andreasohlund Date: Mon, 7 May 2012 11:16:00 +0200 Subject: [PATCH] Updating the manufacturing sample to use the [Unique] property for the purchase order number. Also changing the simulation to be a more real world like scenario. --- Samples/Manufacturing/Manufacturing.suo | Bin 74752 -> 74752 bytes .../OrderService/EndpointConfig.cs | 8 -------- .../OrderService/OrderSagaData.cs | 2 ++ Samples/Manufacturing/Partner/Program.cs | 17 +++++++++-------- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/Samples/Manufacturing/Manufacturing.suo b/Samples/Manufacturing/Manufacturing.suo index db5b4c221a784e172e558dfe4e6f9c415b676870..3e1c639d8fafbc6da540250ffe5d8cc175aec713 100644 GIT binary patch delta 4072 zcmc&13rt(r^eYNt_wT&J;NYW ztF*P*eL8;Up8q}P-s|&*rkJ5A=9Lo?W&|O`Pf3O`&LI`dN|kkI(X65RB+dYOvXKlh zTZv6+AbN%&H<&LITc?r4GuudGW;ID=&M+TP^~+fdmR~k$V2z3sK=F||ut0h5(!0-sX1NMsnpbnU#1rbSpxO5Tx8NosRoO0@}VaYJV50vCda0VGEJHPTUu>5E}@}kWsj)EwJ z0*HfI6!}m;V)@-G91^CK>d*N}mAj<1Kvh(}K&@X|Ce$faC(eAU=Hs zU%t9Z#gxz)&0WlRT1vT!d4fsI$=!2=l&Mp#M>bTC^vEeZHe@0X>5Ivbd59!8Sb1yB zYAn44d3*+R_>iRuH(mp52H-=0s{kJXqyVTCh3kOd0JsV8F{J~10`O0Y1Ai9Y2-1F} zF3B9(cmPA~q-CEx#s;qC_c))v=erZ3lL3Ufuk0^eGte}8bK|2${PFv?U_3<{Hs4D| z9rw9%}{*96UbM z4VW9i4-lkvf_mv-#zEK`fCCW6iQ)*_EM zib!AAb5I0gkq9bpMh+)Hj%M*^Z52}U<=u`{S;#Y0r8A~)x)eyPZVbXq309^ zQH++5i|tu>k61c|C0B>GK^S2ODgve8$cHUOu+!-E^*R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#5+rfXJc6IP8@Ds^*=()!FB)u diff --git a/Samples/Manufacturing/OrderService/OrderService/EndpointConfig.cs b/Samples/Manufacturing/OrderService/OrderService/EndpointConfig.cs index a31784aa955..0413efde7cc 100644 --- a/Samples/Manufacturing/OrderService/OrderService/EndpointConfig.cs +++ b/Samples/Manufacturing/OrderService/OrderService/EndpointConfig.cs @@ -3,12 +3,4 @@ namespace OrderService { public class EndpointConfig : IConfigureThisEndpoint, AsA_Publisher {} - - public class TimeoutConfiguration:IWantCustomInitialization - { - public void Init() - { - Configure.Instance.RunTimeoutManager(); - } - } } \ No newline at end of file diff --git a/Samples/Manufacturing/OrderService/OrderService/OrderSagaData.cs b/Samples/Manufacturing/OrderService/OrderService/OrderSagaData.cs index e30fcee235e..536437288d2 100644 --- a/Samples/Manufacturing/OrderService/OrderService/OrderSagaData.cs +++ b/Samples/Manufacturing/OrderService/OrderService/OrderSagaData.cs @@ -9,6 +9,8 @@ public class OrderSagaData : IContainSagaData public virtual Guid Id { get; set; } public virtual string Originator { get; set; } public virtual string OriginalMessageId { get; set; } + + [Unique] public virtual string PurchaseOrderNumber { get; set; } public virtual Guid PartnerId { get; set; } public virtual DateTime ProvideBy { get; set; } diff --git a/Samples/Manufacturing/Partner/Program.cs b/Samples/Manufacturing/Partner/Program.cs index b64af6e8a63..08d2cefa001 100644 --- a/Samples/Manufacturing/Partner/Program.cs +++ b/Samples/Manufacturing/Partner/Program.cs @@ -80,24 +80,25 @@ static void Main() private static void Simulate(IBus bus, bool step) { Guid partnerId = Guid.NewGuid(); - int numberOfLines; + int numberOfOrders; int secondsToProvideBy; while(true) { - Random r = new Random(); + var r = new Random(); - numberOfLines = 5 + r.Next(0, 5); + numberOfOrders = 5 + r.Next(0, 5); secondsToProvideBy = 10 + r.Next(0, 10); - string purchaseOrderNumber = Guid.NewGuid().ToString(); - - for (int i = 0; i < numberOfLines; i++) - { + + for (var i = 0; i < numberOfOrders; i++) + { + var purchaseOrderNumber = Guid.NewGuid().ToString(); + bus.Send(m => { m.PurchaseOrderNumber = purchaseOrderNumber; m.PartnerId = partnerId; - m.Done = (i == numberOfLines - 1); + m.Done = true; m.ProvideBy = DateTime.UtcNow + TimeSpan.FromSeconds(secondsToProvideBy); m.OrderLines = new List { bus.CreateInstance(ol => {