Пример #1
0
        public MockFailedWorkflowEngine(WorkflowContext context, WorklistItem worklistItem)
            : base(context)
        {
            ExitStrategy.Quitting = false; // <<==== IMPORTANT! Otherwise the engine "loop" will just quit before it has even started
            _worklistItem = worklistItem;

            FinalStatusOutcomeDeterminedHandler += outcomeStatusId =>
            {
                StatusResult = outcomeStatusId;
                ExitStrategy.Quitting = true;
            };
        }
Пример #2
0
        public MockNormalWorkflowEngine(WorkflowContext context, WorklistItem worklistItem)
            : base(context)
        {
            ExitStrategy.Quitting = false;
            _worklistItem = worklistItem;

            FinalStatusOutcomeDeterminedHandler += outcomeStatusId =>
            {
                StatusResult = outcomeStatusId;
                ExitStrategy.Quitting = true;
            };
        }
Пример #3
0
 protected override void UpdateFailureOutcome(long instanceId, string message, WorkItemStatus outcome) { }
Пример #4
0
        protected WorklistItem GetLocationAwareWorklistItem(WorkItemStatus workflowStatusType)
        {
            long? instanceId = null;
            int? activityId = null;
            Guid? activityGuid = null;
            long? keyValue = null;
            int? maxRetries = null;
            int? currentRetries = null;
            string activityName = String.Empty;

            OperationContext.ThreadSafeDataAccess.DataAccessOperation(() =>
            {
                using (var database = new CloudCoreDB())
                {
                    database.Cloudcore_WorkItemStartFromVirtualWorkerByLocation(
                        Core.Modules.Environment.ApplicationId,
                        (int)workflowStatusType.Id,
                        KeepAliveSettings.Instance.TimeOutInSeconds,
                        ref activityGuid,
                        ref activityId,
                        ref instanceId,
                        ref keyValue,
                        LocationConfig.Latitude,
                        LocationConfig.Longitude,
                        LocationConfig.RadiusInMeters,
                        ref maxRetries,
                        ref currentRetries,
                        ref activityName);
                }
            });

            return new WorklistItem(activityId, activityGuid, activityName, maxRetries, currentRetries)
            {
                InstanceId = instanceId,
                KeyValue = keyValue
            };
        }
Пример #5
0
        protected virtual void UpdateFailureOutcome(long instanceId, string message, WorkItemStatus outcomeStatus)
        {
            try
            {
                OperationContext.ThreadSafeDataAccess.DataAccessOperation(() =>
                {
                    using (var database = new CloudCoreDB())
                    {
                        database.Cloudcore_WorkItemFail(instanceId, message, (byte)outcomeStatus.Id);
                    }
                });
            }
            catch (DataThreadDeadlockException ex)
            {
                Logger.Fatal(String.Format("Unable to update workflow final failure status after execution (ID {0}). Exiting...", instanceId),
                             ex, OperationContext.LoggingCategory);

                ExitStrategy.Quitting = true;
                throw;
            }
        }
Пример #6
0
 private void OnFailureStatusOutcomeDetermined(WorkItemStatus outcomeStatusId)
 {
     if (FinalStatusOutcomeDeterminedHandler != null)
         FinalStatusOutcomeDeterminedHandler.Invoke(outcomeStatusId);
 }