public override void RemoveConnections() { base.RemoveConnections(); CancellationHandler = null; FaultHandler = null; }
private Task ExecuteNextNode([NotNull] IActivityNode node, [NotNull] Task task) { if (task.IsCanceled) { Log.Info("At node: {0}. Cancelled", node); IFlowNode handlerNode = node.CancellationHandler; Debug.Assert(handlerNode != null); return(handlerNode.Accept(this)); } if (task.IsFaulted) { string message = $"At node: {node}. Faulted"; Log.Exception(message, task.Exception); IFaultHandlerNode handlerNode = node.FaultHandler; Debug.Assert(handlerNode != null); return(handlerNode.Accept(this)); } Log.Info("At node: {0}. Completed", node); if (node.PointsTo != null) { return(node.PointsTo.Accept(this)); } return(TaskHelper.CompletedTask); }
public FlowBuilder WithDefaultFaultHandler([NotNull] IFaultHandlerNode handler) { handler.AssertNotNull("handler != null"); myDefaultFaultHandler.AssertIsNull("Default fault handler is already set"); handler.AssertIsItemOf(myNodes, "Handler must be part of the flow"); myIsFreezed.AssertFalse("Builder is freezed"); myDefaultFaultHandler = handler; return(this); }
public static TActivityNode ConnectFaultTo <TActivityNode>( [NotNull] this TActivityNode from, [NotNull] IFaultHandlerNode to) where TActivityNode : ActivityNode { from.AssertNotNull("from != null"); to.AssertNotNull("to != null"); from.FaultHandler.AssertIsNull("Fault handler is already set"); from.FaultHandler = to; to.SubscribeToExceptionsOf(from); return(from); }
internal FlowDescription( [CanBeNull] IFlowNode initialNode, [CanBeNull] IFaultHandlerNode defaultFaultHandler, [CanBeNull] IActivityNode defaultCancellationHandler, [NotNull] ReadOnlyCollection <IFlowNode> nodes, [NotNull] ReadOnlyCollection <IVariable> globalVariables) { InitialNode = initialNode; DefaultFaultHandler = defaultFaultHandler; DefaultCancellationHandler = defaultCancellationHandler; Nodes = nodes; GlobalVariables = globalVariables; }
public void Clear() { myDefaultCancellationHandler = null; myDefaultFaultHandler = null; foreach (IFlowNode node in myNodes) { node.RemoveConnections(); } myNodes.Clear(); myGlobalVariables.Clear(); }
public DefaultHandlersSetter([NotNull] FlowDescription flowDescription) { myFlowDescription = flowDescription.NotNull(); myFaultHandler = flowDescription.DefaultFaultHandler; myCancellationHandler = flowDescription.DefaultCancellationHandler; }