/// <inheritdoc/>
 protected override async Task OnNextAsync(IV1WorkflowActivityIntegrationEvent e, CancellationToken cancellationToken)
 {
     if (e is V1WorkflowActivityCompletedIntegrationEvent &&
         this.Action.Sleep != null &&
         this.Action.Sleep.After.HasValue)
     {
         await Task.Delay(this.Action.Sleep.After.Value, cancellationToken);
     }
     await base.OnNextAsync(e, cancellationToken);
 }
 /// <inheritdoc/>
 protected override async Task OnNextAsync(IV1WorkflowActivityIntegrationEvent e, CancellationToken cancellationToken)
 {
     if (e is V1WorkflowActivityCompletedIntegrationEvent completedEvent)
     {
         await base.OnNextAsync(new V1WorkflowActivityCompletedIntegrationEvent(this.Activity.Id, await this.Context.FilterOutputAsync(this.State, completedEvent.Output !.ToObject() !, cancellationToken)), cancellationToken);
     }
     else
     {
         await base.OnNextAsync(e, cancellationToken);
     }
 }
Beispiel #3
0
 /// <inheritdoc/>
 protected override async Task OnNextAsync(IV1WorkflowActivityIntegrationEvent e, CancellationToken cancellationToken)
 {
     if (e is V1WorkflowActivityCompletedIntegrationEvent completedEvent)
     {
         var output = completedEvent.Output.ToObject();
         if (this.Action.ActionDataFilter != null)
         {
             output = await this.Context.FilterOutputAsync(this.Action, output !, cancellationToken);
         }
         await base.OnNextAsync(new V1WorkflowActivityCompletedIntegrationEvent(this.Activity.Id, output), cancellationToken);
     }
     else
     {
         await base.OnNextAsync(e, cancellationToken);
     }
 }
        /// <inheritdoc/>
        public virtual async Task On(V1WorkflowActivity activity, IV1WorkflowActivityIntegrationEvent e, CancellationToken cancellationToken = default)
        {
            if (e == null)
            {
                throw new ArgumentNullException(nameof(e));
            }
            switch (e)
            {
            case V1WorkflowActivityStartedIntegrationEvent:
            case V1WorkflowActivityResumedIntegrationEvent:
                await this.StartOrResumeActivityAsync(activity, cancellationToken);

                break;

            case V1WorkflowActivitySuspendedIntegrationEvent:
                await this.SuspendActivityAsync(activity, cancellationToken);

                break;

            case V1WorkflowActivitySkippedIntegrationEvent:
                await this.SkipActivityAsync(activity, cancellationToken);

                break;

            case V1WorkflowActivityFaultedIntegrationEvent faultedEvent:
                await this.FaultActivityAsync(activity, faultedEvent.Error, cancellationToken);

                break;

            case V1WorkflowActivityCancelledIntegrationEvent:
                await this.CancelActivityAsync(activity, cancellationToken);

                break;

            case V1WorkflowActivityCompletedIntegrationEvent completedEvent:
                await this.SetActivityOutputAsync(activity, completedEvent.Output, cancellationToken);

                break;

            default:
                throw new NotSupportedException($"The specified workflow activity integration event type '{e.GetType().Name}' is not supported in this context");
            }
        }