Exemplo n.º 1
0
        public async Task Handle(WorkflowCompleted notification, CancellationToken cancellationToken)
        {
            var workflowExecutionContext = notification.WorkflowExecutionContext;
            var workflowInstanceId       = workflowExecutionContext.WorkflowInstance.Id;
            var output   = workflowExecutionContext.WorkflowInstance.Output;
            var tenantId = workflowExecutionContext.WorkflowInstance.TenantId;

            var input = new FinishedWorkflowModel
            {
                WorkflowInstanceId = workflowInstanceId,
                Output             = output
            };

            var trigger = new RunWorkflowBookmark
            {
                ChildWorkflowInstanceId = workflowInstanceId
            };

            await _workflowScheduler.FindAndResumeWorkflowsAsync(nameof(RunWorkflow), trigger, tenantId, input, cancellationToken : cancellationToken);
        }
        public async Task Handle(WorkflowCompleted notification, CancellationToken cancellationToken)
        {
            var workflowExecutionContext = notification.WorkflowExecutionContext;
            var workflowInstance         = workflowExecutionContext.WorkflowInstance;
            var workflowInstanceId       = workflowExecutionContext.WorkflowInstance.Id;
            var outputReference          = workflowExecutionContext.WorkflowInstance.Output;
            var output = outputReference != null ? await _workflowStorageService.LoadAsync(outputReference.ProviderName, new WorkflowStorageContext(workflowInstance, outputReference.ActivityId), "Output", cancellationToken) : null;

            var tenantId = workflowExecutionContext.WorkflowInstance.TenantId;

            var input = new FinishedWorkflowModel
            {
                WorkflowInstanceId = workflowInstanceId,
                WorkflowOutput     = output
            };

            var trigger = new RunWorkflowBookmark
            {
                ChildWorkflowInstanceId = workflowInstanceId
            };

            await _workflowScheduler.FindAndResumeWorkflowsAsync(nameof(RunWorkflow), trigger, tenantId, input, cancellationToken : cancellationToken);
        }