public async Task CreateByDefinitionIdAsync(string id) { var workDefinitionEntity = await _workflowDefinitionVersionRepository.GetAsync(id); var workDefinition = ObjectMapper.Map <WorkflowDefinitionVersion, ElsaWorkflowDefinitionVersion>(workDefinitionEntity); await _workflowInvoker.StartAsync(workDefinition); }
public async Task <ActionResult <string> > Start( [FromServices] IWorkflowInvoker wfInvoker, [FromServices] IWorkflowRegistry wfRegistry, [FromServices] IWorkflowDefinitionStore wfStore, string name, CancellationToken cancellationToken) { var correlationId = Guid.NewGuid().ToString(); var definitions = await wfStore.ListAsync(VersionOptions.Published, cancellationToken); var wf = definitions.FirstOrDefault(d => d.Name.ToLower(CultureInfo.InvariantCulture) == name); if (wf == null) { return(NotFound()); } var input = new Variables(new [] { new KeyValuePair <string, object>("withdrawalId", "33") }); var context = await wfInvoker.StartAsync(wf, input : input, correlationId : correlationId, cancellationToken : cancellationToken); return(Ok($"Batched/{correlationId}")); }
public async Task <IActionResult> OnGetStartFlowAsync(string workflowDefinitionId) { var def = await workflowDefinitionStore.GetByIdAsync(workflowDefinitionId, VersionOptions.Latest); if (def != null) { await workflowInvoker.StartAsync(def); } return(RedirectToPage("/Index")); }