/// <summary>
        /// Internal Idle Handler
        /// </summary>
        /// <param name="args">
        /// The args. 
        /// </param>
        private void InternalIdle(WorkflowApplicationIdleEventArgs args)
        {
            if (this.Idle != null)
            {
                var action = this.innerIdle;
                if (action != null)
                {
                    action(args);
                }

                this.Idle(args);
            }
        }
        /// <summary>
        /// The on idle.
        /// </summary>
        /// <param name="args">
        /// The args.
        /// </param>
        private void OnIdle(WorkflowApplicationIdleEventArgs args)
        {
            HttpExceptionHelper.WriteThread(
                "OnWorkflowIdle waiting for bookmark {0} instance Id {1} with bookmarks {2}",
                this.pendingBookmark,
                args.InstanceId,
                args.BookmarksToDelimitedList());

            this.Idle = true;

            if (args.ContainsBookmark(this.pendingBookmark))
            {
                this.pendingBookmark = null;
                this.protocolEvent.Set();
            }
        }
Exemplo n.º 3
0
 /// <summary>
 ///   A Workflow has become idle
 /// </summary>
 /// <param name="args"> The args </param>
 public void OnIdle(WorkflowApplicationIdleEventArgs args)
 {
     this.Refresh();
 }
		private PersistableIdleAction HandleWorkflowApplicationPersistableIdle(WorkflowApplicationIdleEventArgs e)
		{
			if (!base.Disposed)
			{
				PSWorkflowApplicationInstance._structuredTracer.Correlate();
				PSPersistableIdleAction bookmarks = PSPersistableIdleAction.NotDefined;
				if (base.OnPersistableIdleAction != null)
				{
					bookmarks = base.OnPersistableIdleAction(e.Bookmarks, this.suspendAtNextCheckpoint, this);
				}
				if (bookmarks == PSPersistableIdleAction.NotDefined)
				{
					bookmarks = this._job.GetPersistableIdleAction(e.Bookmarks, this.suspendAtNextCheckpoint);
				}
				PSPersistableIdleAction pSPersistableIdleAction = bookmarks;
				switch (pSPersistableIdleAction)
				{
					case PSPersistableIdleAction.None:
					{
						return PersistableIdleAction.None;
					}
					case PSPersistableIdleAction.Persist:
					{
						ThreadPool.QueueUserWorkItem(new WaitCallback(this.HandlePersistence));
						return PersistableIdleAction.None;
					}
					case PSPersistableIdleAction.Unload:
					{
						if (base.Runtime.Configuration.PSWorkflowApplicationPersistUnloadTimeoutSec > 0)
						{
							this.StartPersistUnloadTimer(base.Runtime.Configuration.PSWorkflowApplicationPersistUnloadTimeoutSec);
							return PersistableIdleAction.None;
						}
						else
						{
							this.StartPersistUnloadWithZeroSeconds();
							return PersistableIdleAction.Unload;
						}
					}
					case PSPersistableIdleAction.Suspend:
					{
						this.callSuspendDelegate = true;
						return PersistableIdleAction.Unload;
					}
				}
				return PersistableIdleAction.None;
			}
			else
			{
				return PersistableIdleAction.None;
			}
		}
Exemplo n.º 5
0
        private void HandleWorkflowApplicationIdle(WorkflowApplicationIdleEventArgs e)
        {
            if (Disposed)
                return;

            _structuredTracer.Correlate();
            Tracer.WriteMessage("Workflow Application is idle.");

            // there might be a possibility that stop job is being called by wfApp is Idle handling it properly so all Async execution .
            if (_job.JobStateInfo.State == JobState.Stopping)
            {
                this.StopBookMarkedWorkflow();
                return;
            }

            if (this.OnIdle != null)
                this.OnIdle(e.Bookmarks, this);
        }
 private PersistableIdleAction OnPersistableIdle(WorkflowApplicationIdleEventArgs args)
 {
     _result = args.GetInstanceExtensions<IDSFDataObject>().ToList().First();
     _waitHandle.Set();
     return PersistableIdleAction.Unload;
 }
Exemplo n.º 7
0
 // executed when instance goes idle
 public void OnIdle(WorkflowApplicationIdleEventArgs e)
 {
 }
 void OnIdle(WorkflowApplicationIdleEventArgs e)
 {
     this.CanResumeBookmarks = true;
     this.availableBookmarks = e.Bookmarks;
     this.applicationHandler.OnIdle(e);
 }
Exemplo n.º 9
0
        private static void OnIdle(WorkflowApplicationIdleEventArgs workflowApplicationIdleEventArgs)
        {

        }
Exemplo n.º 10
0
 private static PersistableIdleAction OnPersistableIdle(WorkflowApplicationIdleEventArgs workflowApplicationIdleEventArgs)
 {
     return PersistableIdleAction.Persist;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="NinjectWorkflowApplicationIdleEventArgs"/> class.
 /// </summary>
 /// <param name="workflowApplicationIdleEventArgs">The <see cref="System.Activities.WorkflowApplicationIdleEventArgs"/> instance containing the event data.</param>
 public NinjectWorkflowApplicationIdleEventArgs(WorkflowApplicationIdleEventArgs workflowApplicationIdleEventArgs)
     : base(workflowApplicationIdleEventArgs)
 {
     this.Bookmarks = workflowApplicationIdleEventArgs.Bookmarks
         .Select(info => new NinjectBookmarkInfo(info)).ToList().AsReadOnly();
 }
Exemplo n.º 12
0
 PersistableIdleAction OnPersistableIdle(WorkflowApplicationIdleEventArgs args)
 {
     return PersistableIdleAction.Unload;
 }
Exemplo n.º 13
0
 void OnIdle(WorkflowApplicationIdleEventArgs args)
 {
     // if the response is empty, redirect back to ourselves periodically
     if (!TwilioResponse.HasElements)
     {
         TwilioResponse.Add(new XElement("Pause", new XAttribute("length", 2)));
         TwilioResponse.Add(new XElement("Redirect", SelfUrl));
     }
 }
Exemplo n.º 14
0
 private void workflow_OnIdle(WorkflowApplicationIdleEventArgs e)
 {
     var output = "Bookmark created, waiting for input";
 }
Exemplo n.º 15
0
 public PersistableIdleAction OnIdleAndPersistable(WorkflowApplicationIdleEventArgs e)
 {
     return PersistableIdleAction.Persist;
 }
Exemplo n.º 16
0
 private void WorkflowIdleCallback(WorkflowApplicationIdleEventArgs eArgs)
 {
     //idleEvent.Set();
     var output = eArgs.GetInstanceExtensions<List<string>>();
     var enumerable = output as List<string>[] ?? output.ToArray();
     if (enumerable.First() != null)
     {
         txbOutput.Dispatcher.Invoke (() =>
         {
             foreach (var item in enumerable.First())
             {
                 txbOutput.Text += item + "\r\n";
             }
         });
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="WorkflowIdleEpisodeResult"/> class.
 /// </summary>
 /// <param name="args">
 /// The event args.
 /// </param>
 /// <param name="instanceId">
 /// The instance Id.
 /// </param>
 public WorkflowIdleEpisodeResult(WorkflowApplicationIdleEventArgs args, Guid instanceId)
 {
     this.IdleArgs = args;
     this.InstanceId = instanceId;
 }
Exemplo n.º 18
0
        private PersistableIdleAction HandleWorkflowApplicationPersistableIdle(WorkflowApplicationIdleEventArgs e)
        {
            if (Disposed)
                return PersistableIdleAction.None;

            _structuredTracer.Correlate();

            PSPersistableIdleAction action = PSPersistableIdleAction.NotDefined;

            if (this.OnPersistableIdleAction != null)
                action = this.OnPersistableIdleAction(e.Bookmarks, this.suspendAtNextCheckpoint, this);
            
            if(action == PSPersistableIdleAction.NotDefined) // fall back default handler
                action = _job.GetPersistableIdleAction(e.Bookmarks, this.suspendAtNextCheckpoint);

            switch (action)
            {
                case PSPersistableIdleAction.None:
                    return PersistableIdleAction.None;

                case PSPersistableIdleAction.Persist:
                    System.Threading.ThreadPool.QueueUserWorkItem(this.HandlePersistence);
                    return PersistableIdleAction.None;

                case PSPersistableIdleAction.Unload:
                    if (Runtime.Configuration.PSWorkflowApplicationPersistUnloadTimeoutSec <= 0)
                    {
                        this.StartPersistUnloadWithZeroSeconds();
                        return PersistableIdleAction.Unload;
                    }
                    else
                    {
                        this.StartPersistUnloadTimer(Runtime.Configuration.PSWorkflowApplicationPersistUnloadTimeoutSec);
                        return PersistableIdleAction.None;
                    }

                case PSPersistableIdleAction.Suspend:
                    this.callSuspendDelegate = true;
                    return PersistableIdleAction.Unload;
            }

            return PersistableIdleAction.None;
        }
 void IWorkflowApplicationHandler.OnIdle(WorkflowApplicationIdleEventArgs e)
 {
     lock (managerStateLock)
     {
         if (this.state == ManagerState.Opened)
         {
             this.hostView.Dispatch(() => UpdateInstanceState(e.InstanceId));
         }
     }
 }
Exemplo n.º 20
0
 void workflow_OnIdle(WorkflowApplicationIdleEventArgs e)
 {
     var output = "Bookmark created, waiting for input";
     result.Text = output;
 }
Exemplo n.º 21
0
		private void HandleWorkflowApplicationIdle(WorkflowApplicationIdleEventArgs e)
		{
			if (!base.Disposed)
			{
				PSWorkflowApplicationInstance._structuredTracer.Correlate();
				this.Tracer.WriteMessage("Workflow Application is idle.");
				if (this._job.JobStateInfo.State != JobState.Stopping)
				{
					if (base.OnIdle != null)
					{
						base.OnIdle(e.Bookmarks, this);
					}
					return;
				}
				else
				{
					this.StopBookMarkedWorkflow();
					return;
				}
			}
			else
			{
				return;
			}
		}
Exemplo n.º 22
0
 static PersistableIdleAction persistableIdle(WorkflowApplicationIdleEventArgs e)
 {
     string v = "";
     if (e.Bookmarks[0] != null)
     {
         v = e.Bookmarks[0].BookmarkName;
     }
     writeRunInfo(e.InstanceId, "persistableIdle", v);
     return PersistableIdleAction.Unload;
 }
 /// <summary>
 ///   Determines if there are any bookmarks
 /// </summary>
 /// <param name="args"> The args. </param>
 /// <param name="targetBookmark"> The s. </param>
 /// <returns> The any bookmark. </returns>
 private static bool AnyBookmark(WorkflowApplicationIdleEventArgs args, string targetBookmark)
 {
     return args != null && args.Bookmarks.Any();
 }