Пример #1
0
        public override void RemoveConnections()
        {
            base.RemoveConnections();

            CancellationHandler = null;
            FaultHandler        = null;
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }
Пример #5
0
 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;
 }
Пример #6
0
        public void Clear()
        {
            myDefaultCancellationHandler = null;
            myDefaultFaultHandler        = null;

            foreach (IFlowNode node in myNodes)
            {
                node.RemoveConnections();
            }

            myNodes.Clear();
            myGlobalVariables.Clear();
        }
Пример #7
0
 public DefaultHandlersSetter([NotNull] FlowDescription flowDescription)
 {
     myFlowDescription     = flowDescription.NotNull();
     myFaultHandler        = flowDescription.DefaultFaultHandler;
     myCancellationHandler = flowDescription.DefaultCancellationHandler;
 }