/// <inheritdoc/> public async Task Write(CommittedEvent @event, ConsentId consentId, ScopeId scope, CancellationToken cancellationToken) { _logger.Trace( "Writing Event Horizon Event: {EventLogSequenceNumber} from Tenant: {Tenant} in Microservice {Microservice} to Scope: {Scope}", @event.EventLogSequenceNumber, @event.ExecutionContext.Tenant, @event.ExecutionContext.Microservice, scope); await _eventsToStreamsWriter.Write( await _streams.GetEventLog(scope, cancellationToken).ConfigureAwait(false), _eventFilter, streamPosition => _eventConverter.ToEventLogEvent( new CommittedExternalEvent( streamPosition.Value, @event.Occurred, @event.EventSource, @event.ExecutionContext, @event.Type, false, @event.Content, @event.EventLogSequenceNumber, DateTimeOffset.UtcNow, consentId)), cancellationToken).ConfigureAwait(false); }
/// <inheritdoc/> public async Task <EventLogSequenceNumber> Write(CommittedEvent @event, ConsentId consentId, ScopeId scope, CancellationToken cancellationToken) { _logger.WritingEventHorizonEvent( @event.EventLogSequenceNumber, @event.ExecutionContext.Tenant, @event.ExecutionContext.Microservice, scope); var writtenStreamPosition = await _eventsToStreamsWriter.Write( await _streams.GetEventLog(scope, cancellationToken).ConfigureAwait(false), _eventFilter, streamPosition => _eventConverter.ToEventLogEvent( new CommittedExternalEvent( streamPosition.Value, @event.Occurred, @event.EventSource, @event.ExecutionContext, @event.Type, false, @event.Content, @event.EventLogSequenceNumber, DateTimeOffset.UtcNow, consentId)), cancellationToken).ConfigureAwait(false); _streamWatcher.NotifyForEvent(scope, StreamId.EventLog, writtenStreamPosition); return(writtenStreamPosition.Value); }