示例#1
0
        public MyCustomController()
        {
            /*string configFile = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\GlobalConfiguration.json";
             * MyAppGlobalLib.GlobalConfigReader myConfig = new MyAppGlobalLib.GlobalConfigReader();
             * RESTConfig = myConfig.Load(configFile).RESTConfig;*/
            //GetConfig c = new GetConfig();
            var config = GetConfigRest.GetInstance();

            RESTConfig = config.RESTConfig;
        }
示例#2
0
 public RESTTagDB(RESTConfig restConfig)
 {
     this.restConfig = restConfig;
 }
示例#3
0
 public RESTTagEmployeeDB(RESTConfig restConfig)
 {
     this.restConfig = restConfig;
 }
示例#4
0
 public RESTOrderDetailsDB(RESTConfig restConfig)
 {
     this.restConfig = restConfig;
 }
示例#5
0
 public RESTCustomerCustomerDemoDB(RESTConfig restConfig)
 {
     this.restConfig = restConfig;
 }
示例#6
0
 public RESTTerritoriesDB(RESTConfig restConfig)
 {
     this.restConfig = restConfig;
 }
示例#7
0
 public RESTCategoriesDB(RESTConfig restConfig)
 {
     this.restConfig = restConfig;
 }
示例#8
0
 public RESTRegionDB(RESTConfig restConfig)
 {
     this.restConfig = restConfig;
 }
示例#9
0
 public RESTSuppliersDB(RESTConfig restConfig)
 {
     this.restConfig = restConfig;
 }
示例#10
0
        private async Task <string> CallServiceAsync(string url, string method, string queryString, object input, Dictionary <string, string> headers, string id)
        {
            var      result   = string.Empty;
            Activity activity = null;

            var restConfig = new RESTConfig
            {
                Body        = input == null ? null: JsonConvert.SerializeObject(input),
                Headers     = headers,
                Method      = method,
                QueryString = queryString,
                Url         = url
            };

            var workflowContext = await GetCurrentContext();

            if (workflowContext != null && workflowContext.Status == Status.STARTED)
            {
                var status = GetStatus(Model.ActivityType.Task, Constants.LAMBDA_BIZ_ACTIVITY_TYPE, id, workflowContext);

                if (status == Status.NONE)
                {
                    var decisionRequest = new RespondDecisionTaskCompletedRequest
                    {
                        TaskToken = workflowContext.ReferenceToken,
                        Decisions = new List <Decision>
                        {
                            new Decision
                            {
                                DecisionType = DecisionType.ScheduleActivityTask,
                                ScheduleActivityTaskDecisionAttributes = new ScheduleActivityTaskDecisionAttributes
                                {
                                    Input        = JsonConvert.SerializeObject(restConfig),
                                    ActivityId   = id,
                                    Control      = id,
                                    ActivityType = new Amazon.SimpleWorkflow.Model.ActivityType
                                    {
                                        Name    = Constants.LAMBDA_BIZ_ACTIVITY_TYPE,
                                        Version = Constants.LAMBDA_BIZ_TYPE_VERSION
                                    },
                                    TaskList = new TaskList
                                    {
                                        Name = Constants.LAMBDA_BIZ_TASK_LIST + _orchestrationId
                                    },
                                    StartToCloseTimeout    = "NONE",
                                    ScheduleToCloseTimeout = "NONE",
                                    ScheduleToStartTimeout = "NONE",
                                    HeartbeatTimeout       = "NONE"
                                },
                            }
                        }
                    };

                    await _amazonSimpleWorkflowClient.RespondDecisionTaskCompletedAsync(decisionRequest);
                }
                else
                {
                    await SetMarker(Model.ActivityType.Task, Constants.LAMBDA_BIZ_ACTIVITY_TYPE, id, status, workflowContext.ReferenceToken);
                    await RaiseEventAsync(Constants.LAMBDA_BIZ_EVENT, _orchestrationId, Constants.LAMBDA_BIZ_EVENT);

                    activity = FindActivity(Model.ActivityType.Task, id, Constants.LAMBDA_BIZ_ACTIVITY_TYPE, workflowContext.Activities);
                }

                if (status == Status.NONE || status == Status.SCHEDULED || status == Status.STARTED)
                {
                    var      waitStatus          = Status.NONE;
                    Workflow workflowWaitContext = null;


                    do
                    {
                        workflowWaitContext = await GetCurrentContext();

                        waitStatus = GetStatus(Model.ActivityType.Task, Constants.LAMBDA_BIZ_ACTIVITY_TYPE, id, workflowWaitContext);
                        await SetMarker(Model.ActivityType.Task, Constants.LAMBDA_BIZ_ACTIVITY_TYPE, id, waitStatus, workflowWaitContext.ReferenceToken);
                        await RaiseEventAsync(Constants.LAMBDA_BIZ_EVENT, _orchestrationId, Constants.LAMBDA_BIZ_EVENT);
                    }while (waitStatus != Status.SUCCEEDED && waitStatus != Status.FAILED && waitStatus != Status.TIMEOUT);

                    activity = FindActivity(Model.ActivityType.Task, id, Constants.LAMBDA_BIZ_ACTIVITY_TYPE, workflowWaitContext.Activities);
                }
            }

            if (activity.Status == Status.FAILED)
            {
                throw new Exception(activity.FailureDetails);
            }

            if (activity.Status == Status.TIMEOUT)
            {
                throw new Exception("Time-Out");
            }

            result = activity.Result;
            return(result);
        }
示例#11
0
 public RESTProductsDB(RESTConfig restConfig)
 {
     this.restConfig = restConfig;
 }
示例#12
0
 public RESTShippersDB(RESTConfig restConfig)
 {
     this.restConfig = restConfig;
 }
示例#13
0
 public RESTEmployeesDB(RESTConfig restConfig)
 {
     this.restConfig = restConfig;
 }
示例#14
0
 public RESTCustomerDemographicsDB(RESTConfig restConfig)
 {
     this.restConfig = restConfig;
 }