/// <inheritdoc/>
        public virtual async Task HandleAsync(V1WorkflowInstanceStartedDomainEvent e, CancellationToken cancellationToken = default)
        {
            var metrics = await this.GetOrCreateV1OperationalReportsForAsync(e.CreatedAt, cancellationToken);

            metrics.RunningInstances++;
            await this.OperationalReports.UpdateAsync(metrics, cancellationToken);

            await this.OperationalReports.SaveChangesAsync(cancellationToken);
        }
Esempio n. 2
0
        /// <inheritdoc/>
        public virtual async Task HandleAsync(V1WorkflowInstanceStartedDomainEvent e, CancellationToken cancellationToken = default)
        {
            var workflowInstance = await this.Mediator.ExecuteAndUnwrapAsync(new V1FindByIdQuery <Integration.Models.V1WorkflowInstance, string>(e.AggregateId));

            var workflow = await this.GetOrReconcileProjectionAsync(workflowInstance.WorkflowId, cancellationToken);

            workflow.RunningInstanceCount++;
            await this.Projections.UpdateAsync(workflow, cancellationToken);

            await this.Projections.SaveChangesAsync(cancellationToken);
        }
        /// <inheritdoc/>
        public virtual async Task HandleAsync(V1WorkflowInstanceStartedDomainEvent e, CancellationToken cancellationToken = default)
        {
            var instance = await this.GetOrReconcileProjectionAsync(e.AggregateId, cancellationToken);

            instance.LastModified = e.CreatedAt.UtcDateTime;
            instance.StartedAt    = e.CreatedAt.UtcDateTime;
            instance.Status       = V1WorkflowInstanceStatus.Running;
            await this.Projections.UpdateAsync(instance, cancellationToken);

            await this.Projections.SaveChangesAsync(cancellationToken);

            await this.PublishIntegrationEventAsync(e, cancellationToken);
        }