public override bool Compensate(WorkLog item, RoutingSlip routingSlip) { object reservationId = item.Result["reservationId"]; Logger.Message($"Cancelled flight {reservationId}."); return(true); }
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); }
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); } } }
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); } } }
public abstract bool AcceptMessage(Uri?uri, RoutingSlip routingSlip);
public abstract bool Compensate(WorkLog item, RoutingSlip routingSlip);