Exemplo n.º 1
0
        public override bool Compensate(WorkLog item, RoutingSlip routingSlip)
        {
            object reservationId = item.Result["reservationId"];

            Logger.Message($"Cancelled flight {reservationId}.");

            return(true);
        }
Exemplo n.º 2
0
        public override Boolean AcceptMessage(Uri?uri, RoutingSlip routingSlip)
        {
            var activity = new T();

            if (activity.CompensationQueueAddress.Equals(uri))
            {
                ProcessBackwardMessage(routingSlip);
                return(true);
            }
            if (activity.WorkItemQueueAddress.Equals(uri))
            {
                ProcessForwardMessage(routingSlip);
                return(true);
            }
            return(false);
        }
Exemplo n.º 3
0
 public void ProcessBackwardMessage(RoutingSlip routingSlip)
 {
     if (routingSlip.IsInProgress)
     {
         // UndoLast can put new work on the routing slip
         // and return false to go back on the forward
         // path.
         if (routingSlip.UndoLast())
         {
             // recursion stands for passing context via message
             // the routing slip can be fully serialized and passed
             // between systems .
             _send(routingSlip.CompensationUri, routingSlip);
         }
         else
         {
             _send(routingSlip.ProgressUri, routingSlip);
         }
     }
 }
Exemplo n.º 4
0
 public void ProcessForwardMessage(RoutingSlip routingSlip)
 {
     if (!routingSlip.IsCompleted)
     {
         // if the current step is successful, proceed
         // otherwise go to the Unwind path
         if (routingSlip.ProcessNext())
         {
             // recursion stands for passing context via message
             // the routing slip can be fully serialized and passed
             // between systems.
             _send(routingSlip.ProgressUri, routingSlip);
         }
         else
         {
             // pass message to unwind message route
             _send(routingSlip.CompensationUri, routingSlip);
         }
     }
 }
Exemplo n.º 5
0
 public abstract bool AcceptMessage(Uri?uri, RoutingSlip routingSlip);
Exemplo n.º 6
0
 public abstract bool Compensate(WorkLog item, RoutingSlip routingSlip);