/// <inheritdoc /> public Task <CommitAggregateEventsResponse> CommitAggregateEvents(CommitAggregateEventsRequest request, CancellationToken cancellationToken) { //_logger.EventsReceivedForCommitting(true, events.Count); //Log.AggregateEventsSuccessfullyCommitted(_logger)) //Log.ErrorCommittingAggregateEvents(_logger, exception)); return(_getEventStoreClient(GetTenantFrom(request.CallContext)) .CommitForAggregate(request, _rootContext, cancellationToken)); }
/// <summary> /// Creates an <see cref="CommitAggregateEventsRequest"/> from the given <see cref="UncommittedAggregateEvents"/> and <see cref="ExecutionContext"/>. /// </summary> /// <param name="events">The <see cref="UncommittedAggregateEvents"/>.</param> /// <param name="executionContext">The <see cref="ExecutionContext"/>.</param> /// <returns>The <see cref="CommitAggregateEventsRequest"/>.</returns> public static CommitAggregateEventsRequest ToCommitRequest(this UncommittedAggregateEvents events, ExecutionContext executionContext) { var request = new CommitAggregateEventsRequest { CallContext = new CallRequestContext { ExecutionContext = executionContext.ToProtobuf() }, Events = new Events.Contracts.UncommittedAggregateEvents { AggregateRootId = events.AggregateRoot.Id.ToProtobuf(), EventSourceId = events.EventSource, ExpectedAggregateRootVersion = events.ExpectedAggregateRootVersion, } }; request.Events.Events.AddRange(events.Select(_ => new Events.Contracts.UncommittedAggregateEvents.Types.UncommittedAggregateEvent { Content = _.Content, Public = _.Public, EventType = _.Type.ToProtobuf() })); return(request); }
/// <inheritdoc/> public override Task <CommitAggregateEventsResponse> CommitForAggregate(CommitAggregateEventsRequest request, ServerCallContext context) => _eventStore.CommitAggregateEvents(request, context.CancellationToken);