예제 #1
0
 /// <inheritdoc/>
 public async Task Write(CommittedEvent @event, StreamId streamId, PartitionId partitionId, CancellationToken cancellationToken)
 {
     _logger.Trace("Writing Event: {EventLogSequenceNumber} to Public Stream: {Stream}", @event.EventLogSequenceNumber, streamId);
     await _eventsToStreamsWriter.Write(
         await _streams.GetPublic(streamId, cancellationToken).ConfigureAwait(false),
         _filter,
         streamPosition => _eventConverter.ToStoreStreamEvent(@event, streamPosition, partitionId),
         cancellationToken).ConfigureAwait(false);
 }
예제 #2
0
        /// <inheritdoc/>
        public async Task <ICanFetchEventsFromStream> GetFetcherFor(ScopeId scopeId, IStreamDefinition streamDefinition, CancellationToken cancellationToken)
        {
            if (streamDefinition.StreamId == StreamId.EventLog)
            {
                return(await CreateStreamFetcherForEventLog(scopeId, cancellationToken).ConfigureAwait(false));
            }

            if (streamDefinition.Public)
            {
                return(CreateStreamFetcherForStreamEventCollection(
                           await _streams.GetPublic(streamDefinition.StreamId, cancellationToken).ConfigureAwait(false),
                           streamDefinition.StreamId,
                           streamDefinition.Partitioned));
            }

            return(CreateStreamFetcherForStreamEventCollection(
                       await _streams.Get(scopeId, streamDefinition.StreamId, cancellationToken).ConfigureAwait(false),
                       streamDefinition.StreamId,
                       streamDefinition.Partitioned));
        }
    /// <inheritdoc/>
    public async Task Write(CommittedEvent @event, StreamId streamId, PartitionId partitionId, CancellationToken cancellationToken)
    {
        _logger.WritingEventToPublisStream(@event.EventLogSequenceNumber, streamId);
        var writtenStreamPosition = await _eventsToStreamsWriter.Write(
            await _streams.GetPublic(streamId, cancellationToken).ConfigureAwait(false),
            _filter,
            streamPosition => _eventConverter.ToStoreStreamEvent(@event, streamPosition, partitionId),
            cancellationToken).ConfigureAwait(false);

        _streamWatcher.NotifyForEvent(streamId, writtenStreamPosition);
    }