Ejemplo n.º 1
0
        public override void RunCommand(object sender)
        {
            var engine                 = (AutomationEngineInstance)sender;
            var vQueueItem             = (Dictionary <string, object>)v_QueueItem.ConvertUserVariableToObject(engine);
            var vQueueItemErrorMessage = v_QueueItemErrorMessage.ConvertUserVariableToString(engine);
            var vQueueItemErrorCode    = v_QueueItemErrorCode.ConvertUserVariableToString(engine);

            var client = AuthMethods.GetAuthToken();

            Guid transactionKey = (Guid)vQueueItem["LockTransactionKey"];

            switch (v_QueueItemStatusType)
            {
            case "Successful":
                QueueItemMethods.CommitQueueItem(client, transactionKey);
                break;

            case "Failed - Should Retry":
                QueueItemMethods.RollbackQueueItem(client, transactionKey, vQueueItemErrorCode, vQueueItemErrorMessage, false);
                break;

            case "Failed - Fatal":
                QueueItemMethods.RollbackQueueItem(client, transactionKey, vQueueItemErrorCode, vQueueItemErrorMessage, true);
                break;
            }
        }
        public async override Task RunCommand(object sender)
        {
            var engine     = (IAutomationEngineInstance)sender;
            var vQueueItem = (Dictionary <string, object>) await v_QueueItem.EvaluateCode(engine);

            var vQueueItemErrorMessage = (string)await v_QueueItemErrorMessage.EvaluateCode(engine);

            var vQueueItemErrorCode = (string)await v_QueueItemErrorCode.EvaluateCode(engine);

            var  userInfo       = ServerSessionVariableMethods.GetUserInfo(engine);
            Guid transactionKey = (Guid)vQueueItem["LockTransactionKey"];

            if (transactionKey == null || transactionKey == Guid.Empty)
            {
                throw new NullReferenceException($"Transaction key {transactionKey} is invalid or not found");
            }

            switch (v_QueueItemStatusType)
            {
            case "Successful":
                QueueItemMethods.CommitQueueItem(userInfo, transactionKey);
                break;

            case "Failed - Should Retry":
                QueueItemMethods.RollbackQueueItem(userInfo, transactionKey, vQueueItemErrorCode, vQueueItemErrorMessage, false);
                break;

            case "Failed - Fatal":
                QueueItemMethods.RollbackQueueItem(userInfo, transactionKey, vQueueItemErrorCode, vQueueItemErrorMessage, true);
                break;
            }
        }
        public override void RunCommand(object sender)
        {
            var engine                 = (IAutomationEngineInstance)sender;
            var vQueueItem             = (Dictionary <string, object>)v_QueueItem.ConvertUserVariableToObject(engine, nameof(v_QueueItem), this);
            var vQueueItemErrorMessage = v_QueueItemErrorMessage.ConvertUserVariableToString(engine);
            var vQueueItemErrorCode    = v_QueueItemErrorCode.ConvertUserVariableToString(engine);

            var client = AuthMethods.GetAuthToken();

            Guid transactionKey = (Guid)vQueueItem["LockTransactionKey"];

            if (transactionKey == null || transactionKey == Guid.Empty)
            {
                throw new NullReferenceException($"Transaction key {transactionKey} is invalid or not found");
            }

            switch (v_QueueItemStatusType)
            {
            case "Successful":
                QueueItemMethods.CommitQueueItem(client, transactionKey);
                break;

            case "Failed - Should Retry":
                QueueItemMethods.RollbackQueueItem(client, transactionKey, vQueueItemErrorCode, vQueueItemErrorMessage, false);
                break;

            case "Failed - Fatal":
                QueueItemMethods.RollbackQueueItem(client, transactionKey, vQueueItemErrorCode, vQueueItemErrorMessage, true);
                break;
            }
        }