Exemplo n.º 1
0
 public void ReceiveMessageB(FlowContext <string, IEnumerable <string> > flowContext)
 {
     if (flowContext.IsSucessed)
     {
         _capBus.Publish(string.Empty, flowContext.MarkComplete <string, IEnumerable <string> >(flowContext.Result.Data.Append("B1.Complete")));
     }
     else
     {
         _capBus.Publish(string.Empty, flowContext.RollBack <string, IEnumerable <string> >(flowContext.Messge + " -> B1.Rollback"));
     }
 }
Exemplo n.º 2
0
        public void Rollback(FlowContext <string, IEnumerable <string> > flowContext)
        {
            System.Diagnostics.Debug.WriteLine("---- [B.Completed] message received: " + DateTime.Now + ",sent time: " + flowContext.Messge);

            if (flowContext.IsSucessed)
            {
                _capBus.Publish(string.Empty, flowContext.MarkComplete <string, IEnumerable <string> >(flowContext.Result.Data.Append("B.Complete")));
            }
            else
            {
                _capBus.Publish(string.Empty, flowContext.RollBack <string, IEnumerable <string> >(flowContext.Messge + " -> A.Rollback"));
            }
        }
Exemplo n.º 3
0
        public void ReceiveMessageC(FlowContext <string> flowContext)
        {
            System.Diagnostics.Debug.WriteLine("----- [B1] message received: " + DateTime.Now);
            var nextMessage = string.Join(" -> ", flowContext.Messge, "B1");

            var value = _random.Next(0, 2);

            if (value < 1)
            {
                flowContext.AppendInfo("Completed in B1");
                _capBus.Publish(string.Empty, flowContext.MarkComplete <string, IEnumerable <string> >(nextMessage.Split(" -> ")));
            }
            else
            {
                flowContext.AppendInfo("Rollback in B1");
                _capBus.Publish(string.Empty, flowContext.RollBack <string, IEnumerable <string> >(nextMessage + " -> B1.Rollback", "Just for test"));
            }
        }