public async Task <string> CreateJobAsync(string sessionId, string process_ID, long requestNumber, InputVariableCollection inputVarCollection = null) { logger.LogDebug($"CreateJobAsync requestNumber fired {requestNumber}"); // Set up the create new job method // Create a job service client so we call the methods in the job service e.g. createjob etc var jobSvc = new KTA_JobServices.JobServiceClient(); // Set up variables for the CreateJob method. Create job requires sessionid, process identity, and process initialization variables (input variables) // CreateJob method returns the Job Identity (Job Id). var procIdentity = new KTA_JobServices.ProcessIdentity(); var jobInit = new KTA_JobServices.JobInitialization(); // These variables are used for the return object (job identity) var jobIdentity = new KTA_JobServices.JobIdentity(); // This is the process identity of the Loan Application API process. This Id was obtained by running a select * from the Business_Process table procIdentity.Id = process_ID; logger.LogDebug($"procIdentity.Id {procIdentity.Id}"); if (inputVarCollection == null) { inputVarCollection = new KTA_JobServices.InputVariableCollection(); // Set up each inputvariable to job (process initialization variables) // Must use the ID of the variable in the process, not its display name KTA_JobServices.InputVariable id = new KTA_JobServices.InputVariable(); logger.LogDebug($"KTA_JobServices.InputVariable id {id.Id}"); id.Id = "REQUESTID"; id.Value = requestNumber; inputVarCollection.Add(id); } // Populate the InputVariables to the job jobInit.InputVariables = inputVarCollection; // Create the job, passing the session id, process identity and inputvariables. A job identity object containing the job id(string) is returned // from the method call jobIdentity = await jobSvc.CreateJobAsync(sessionId, procIdentity, jobInit); logger.LogDebug($"Create Job Identity jobId fired {jobIdentity.Id}"); // Return the job i return(jobIdentity.Id); }
public KTA_JobServices.InputVariableCollection BuildInputVariableCollection(List <Tuple <string, object> > inputToService) { KTA_JobServices.InputVariableCollection inputVarCollection = new KTA_JobServices.InputVariableCollection(); foreach (Tuple <string, object> oneInput in inputToService) { KTA_JobServices.InputVariable inputVariable = new KTA_JobServices.InputVariable(); inputVariable.Id = oneInput.Item1; inputVariable.Value = oneInput.Item2; inputVarCollection.Add(inputVariable); } return(inputVarCollection); }