public AllStreamSubscription( long?fromPosition, IReadonlyStreamStore readonlyStreamStore, IObservable <Unit> streamStoreAppendedNotification, StreamMessageReceived streamMessageReceived, SubscriptionDropped subscriptionDropped = null, string name = null) : base(readonlyStreamStore, streamStoreAppendedNotification, streamMessageReceived, subscriptionDropped, name) { FromPosition = fromPosition; LastPosition = fromPosition; _nextPosition = fromPosition + 1 ?? Position.Start; }
protected SubscriptionBase( IReadonlyStreamStore readonlyStreamStore, IObservable <Unit> streamStoreAppendedNotification, StreamMessageReceived streamMessageReceived, SubscriptionDropped subscriptionDropped = null, string name = null) { ReadonlyStreamStore = readonlyStreamStore; StreamStoreAppendedNotification = streamStoreAppendedNotification; StreamMessageReceived = streamMessageReceived; Name = string.IsNullOrWhiteSpace(name) ? Guid.NewGuid().ToString() : name; SubscriptionDropped = subscriptionDropped ?? ((_, __) => { }); }
public StreamSubscription( string streamId, int startVersion, IReadonlyStreamStore readonlyStreamStore, IObservable <Unit> streamStoreAppendedNotification, StreamMessageReceived streamMessageReceived, SubscriptionDropped subscriptionDropped, string name = null) : base(readonlyStreamStore, streamStoreAppendedNotification, streamMessageReceived, subscriptionDropped, name) { _streamId = streamId; _nextVersion = startVersion; _lastVersion = startVersion - 1; }
protected override IStreamSubscription SubscribeToStreamInternal( string streamId, int?startVersion, StreamMessageReceived streamMessageReceived, SubscriptionDropped subscriptionDropped, HasCaughtUp hasCaughtUp, bool prefetchJsonData, string name) => new StreamSubscription( streamId, startVersion, this, GetStoreObservable, streamMessageReceived, subscriptionDropped, hasCaughtUp, prefetchJsonData, name);
public Task <IAllStreamSubscription> SubscribeToAll( long?fromPositionExclusive, StreamMessageReceived streamMessageReceived, SubscriptionDropped subscriptionDropped = null, string name = null, CancellationToken cancellationToken = default(CancellationToken)) { Ensure.That(streamMessageReceived, nameof(streamMessageReceived)).IsNotNull(); CheckIfDisposed(); return(SubscribeToAllInternal(fromPositionExclusive, streamMessageReceived, subscriptionDropped, name, cancellationToken)); }
public IStreamSubscription SubscribeToStream( StreamId streamId, int?continueAfterVersion, StreamMessageReceived streamMessageReceived, SubscriptionDropped subscriptionDropped = null, HasCaughtUp hasCaughtUp = null, bool prefetchJsonData = true, string name = null) => new StreamSubscription( streamId, continueAfterVersion, this, _streamStoreNotifier.Value, streamMessageReceived, subscriptionDropped, hasCaughtUp, prefetchJsonData, name);
protected override IStreamSubscription SubscribeToStreamInternal( string streamId, int?startVersion, StreamMessageReceived streamMessageReceived, SubscriptionDropped subscriptionDropped, HasCaughtUp hasCaughtUp, string name) { return(new StreamSubscription( streamId, startVersion, this, GetStoreObservable, streamMessageReceived, subscriptionDropped, hasCaughtUp, name)); }
protected override async Task <IAllStreamSubscription> SubscribeToAllInternal( long?fromPosition, StreamMessageReceived streamMessageReceived, SubscriptionDropped subscriptionDropped, string name, CancellationToken cancellationToken) { var subscription = new AllStreamSubscription( fromPosition, this, GetStoreObservable, streamMessageReceived, subscriptionDropped, name); await subscription.Start(cancellationToken); return(subscription); }
public IStreamSubscription SubscribeToStream( StreamId streamId, int?continueAfterVersion, StreamMessageReceived streamMessageReceived, SubscriptionDropped subscriptionDropped = null, HasCaughtUp hasCaughtUp = null, bool prefetchJsonData = true, string name = null) { return(_streamStore .SubscribeToStream( streamId, continueAfterVersion, streamMessageReceived, subscriptionDropped, hasCaughtUp, prefetchJsonData, name)); }
protected override async Task <IStreamSubscription> SubscribeToStreamInternal( string streamId, int startVersion, StreamMessageReceived streamMessageReceived, SubscriptionDropped subscriptionDropped, string name, CancellationToken cancellationToken) { var subscription = new StreamSubscription( streamId, startVersion, this, GetStoreObservable, streamMessageReceived, subscriptionDropped); await subscription.Start(cancellationToken); return(subscription); }
protected override IStreamSubscription SubscribeToStreamInternal( string streamId, int?startVersion, StreamMessageReceived streamMessageReceived, SubscriptionDropped subscriptionDropped, HasCaughtUp hasCaughtUp, bool prefetchJsonData, string name) { return(new StreamSubscription( streamId, startVersion, this, _subscriptions, streamMessageReceived, subscriptionDropped, hasCaughtUp, prefetchJsonData, name)); }
public Task <IStreamSubscription> SubscribeToStream( string streamId, int fromVersionExclusive, StreamMessageReceived streamMessageReceived, SubscriptionDropped subscriptionDropped = null, string name = null, CancellationToken cancellationToken = default(CancellationToken)) { Ensure.That(streamId, nameof(streamId)).IsNotNullOrWhiteSpace(); Ensure.That(streamMessageReceived, nameof(streamMessageReceived)).IsNotNull(); CheckIfDisposed(); return(SubscribeToStreamInternal(streamId, fromVersionExclusive, streamMessageReceived, subscriptionDropped, name, cancellationToken)); }
public IStreamSubscription SubscribeToStream( string streamId, int?continueAfterVersion, StreamMessageReceived streamMessageReceived, SubscriptionDropped subscriptionDropped = null, HasCaughtUp hasCaughtUp = null, string name = null) { Ensure.That(streamId, nameof(streamId)).IsNotNullOrWhiteSpace(); Ensure.That(streamMessageReceived, nameof(streamMessageReceived)).IsNotNull(); GuardAgainstDisposed(); return(SubscribeToStreamInternal( streamId, continueAfterVersion, streamMessageReceived, subscriptionDropped, hasCaughtUp, name)); }
public async Task ReadStreamEventsForward(string stream, StreamMessageReceived streamMessageReceived) { StreamEventsSlice currentSlice = null; long nextSliceStart = StreamPosition.Start; do { currentSlice = await _eventSourcing.ReadStreamEventsForwardAsync(stream, nextSliceStart, 100, false) .ConfigureAwait(false); nextSliceStart = currentSlice.NextEventNumber; foreach (var @event in currentSlice.Events) { await streamMessageReceived(new EventResponse( @event.Event.EventStreamId, @event.Event.EventId, @event.Event.EventNumber, @event.Event.EventType, @event.Event.Data )); } } while (!currentSlice.IsEndOfStream); }
protected abstract Task <IAllStreamSubscription> SubscribeToAllInternal( long?fromPosition, StreamMessageReceived streamMessageReceived, SubscriptionDropped subscriptionDropped, string name, CancellationToken cancellationToken);
public async Task SubscribeToAllAsync(StreamMessageReceived streamMessageReceived) { // TODO: CARLOS await Task.FromResult(true); }