Пример #1
0
        public async Task <OpenApiResult> StartWorkflowInstance(string tenantId, StartWorkflowInstanceRequest body)
        {
            ITenant tenant = await this.marainServicesTenancy.GetRequestingTenantAsync(tenantId).ConfigureAwait(false);

            IWorkflowEngine workflowEngine = await this.workflowEngineFactory.GetWorkflowEngineAsync(tenant).ConfigureAwait(false);

            await workflowEngine.StartWorkflowInstanceAsync(body).ConfigureAwait(false);

            return(this.CreatedResult());
        }
Пример #2
0
 /// <inheritdoc />
 public Task EnqueueStartWorkflowInstanceRequestAsync(
     StartWorkflowInstanceRequest request,
     Guid operationId)
 {
     return(this.EnqueueMessageEnvelopeAsync(
                new WorkflowMessageEnvelope(this.propertyBagFactory.Create(PropertyBagValues.Empty))
     {
         StartWorkflowInstanceRequest = request,
     }));
 }
Пример #3
0
        public async Task GivenIHaveStartedAnInstanceOfTheWorkflowWithInstanceIdAndUsingContextObject(string workflowId, string instanceId, string contextInstanceName)
        {
            ITenantedWorkflowEngineFactory engineFactory = this.serviceProvider.GetRequiredService <ITenantedWorkflowEngineFactory>();
            IWorkflowEngine engine = await engineFactory.GetWorkflowEngineAsync(this.transientTenantManager.PrimaryTransientClient).ConfigureAwait(false);

            IDictionary <string, string> context = this.scenarioContext.Get <IDictionary <string, string> >(contextInstanceName);

            var request =
                new StartWorkflowInstanceRequest
            {
                WorkflowId         = workflowId,
                WorkflowInstanceId = instanceId,
                Context            = context,
            };

            await engine.StartWorkflowInstanceAsync(request).ConfigureAwait(false);
        }
Пример #4
0
        public async Task <OpenApiResult> HandleStartNewWorkflowInstanceRequest(IOpenApiContext context, StartWorkflowInstanceRequest body)
        {
            ITenant tenant = await this.marainServicesTenancy.GetRequestingTenantAsync(context.CurrentTenantId).ConfigureAwait(false);

            string delegatedTenantId = await this.marainServicesTenancy.GetDelegatedTenantIdForRequestingTenantAsync(tenant.Id).ConfigureAwait(false);

            var operationId = Guid.NewGuid();
            CreateOperationHeaders operationHeaders = await this.operationsControl.CreateOperationAsync(delegatedTenantId, operationId).ConfigureAwait(false);

            var envelope = new WorkflowMessageEnvelope(this.propertyBagFactory.Create(PropertyBagValues.Empty))
            {
                StartWorkflowInstanceRequest = body,
                OperationId = operationId,
                TenantId    = context.CurrentTenantId,
            };

            var durableFunctionsOpenApiContext = (DurableFunctionsOpenApiContext)context;

            await durableFunctionsOpenApiContext.OrchestrationClient.StartNewWithCustomSerializationSettingsAsync(
                nameof(TriggerExecutionOrchestrator),
                operationId.ToString(),
                envelope,
                this.serializerSettingsProvider.Instance).ConfigureAwait(false);

            return(this.AcceptedResult(operationHeaders.Location));
        }