/// <inheritdoc/> public virtual async Task <V1Event?> ConsumeOrBeginCorrelateEventAsync(V1ConsumeWorkflowInstancePendingEventCommand command, CancellationToken cancellationToken = default) { if (command == null) { throw new ArgumentNullException(nameof(command)); } return(await this.Mediator.ExecuteAndUnwrapAsync(this.Mapper.Map <Application.Commands.WorkflowInstances.V1ConsumeOrBeginCorrelateEventCommand>(command), cancellationToken)); }
/// <inheritdoc/> public virtual async Task <V1Event?> ConsumeOrBeginCorrelateEventAsync(V1ConsumeWorkflowInstancePendingEventCommand command, CancellationToken cancellationToken = default) { var result = await this.RuntimeApi.ConsumeOrBeginCorrelateEventAsync(command, cancellationToken); if (!result.Succeeded) { throw new OperationResultException(new OperationResult(result.Code, result.Errors?.Select(e => new Neuroglia.Error(e.Code, e.Message))?.ToArray())); } return(result.Data !); }
/// <inheritdoc/> public virtual async Task <GrpcApiResult <V1Event?> > ConsumeOrBeginCorrelateEventAsync(V1ConsumeWorkflowInstancePendingEventCommand command, CallContext context = default) { return(GrpcApiResult.CreateFor(await this.Mediator.ExecuteAsync(Mapper.Map <Application.Commands.WorkflowInstances.V1ConsumeOrBeginCorrelateEventCommand>(command), context.CancellationToken))); }