コード例 #1
0
        /// <summary>
        /// This should only be called when restoring an existing workflow. This is a short blocking operation. It only waits a short amount of time. It if exits too early the workflow does not come back.
        /// </summary>
        /// <param name="id"></param>
        /// <exception cref="System.Runtime.DurableInstancing.InstanceLockedException"></exception>
        /// <exception cref="ArgumentNullException"></exception>
        public void ReloadAndRun(Guid id)
        {
            if (id == null)
            {
                throw new ArgumentNullException(nameof(id));
            }

            _log.Info("Attempting to readload activity. Id=" + id.ToString());

            _application.Load(id);
            _application.Run(_timeOut);

            ActivityStartedEvent?.Invoke(id, _application.WorkflowDefinition);

            //Give it time to startup before exiting.
            _reloadWaitHandler.WaitOne(new TimeSpan(0, 0, 5));
        }
コード例 #2
0
        /// <summary>
        /// Reloads the workflow starting from a bookmark.
        /// </summary>
        /// <param name="id">Workflow Id</param>
        /// <param name="bookmarkName">The name of the bookmark to be resumed.</param>
        /// <param name="value">An object passed as a parameter to the method that is invoked when the bookmark resumes.</param>
        /// <returns>NotFound | NotReady | Success</returns>
        /// <exception cref="System.Runtime.DurableInstancing.InstanceLockedException"></exception>
        /// <exception cref="ArgumentNullException"></exception>
        public BookmarkResumptionResult ReloadAndRun(Guid id, string bookmarkName, object value)
        {
            if (id == null)
            {
                throw new ArgumentNullException(nameof(id));
            }

            if (string.IsNullOrEmpty(bookmarkName))
            {
                throw new ArgumentNullException(nameof(bookmarkName));
            }

            _log.Info("Attempting to readload bookmark=" + bookmarkName);


            ActivityStartedEvent?.Invoke(id, _application.WorkflowDefinition);
            _application.Run(_timeOut);

            return(_application.ResumeBookmark(bookmarkName, value, _timeOut));
        }
コード例 #3
0
        /// <summary>
        /// Runs the workflow.
        /// </summary>
        public void Run()
        {
            _application.Run(_timeOut);

            ActivityStartedEvent?.Invoke(_application.Id, _application.WorkflowDefinition);
        }