private void AddSubscriber(Guid publishWithCorrelationId, IProjectionSubscription subscription) { _logger.Trace("The '{0}' projection subscribed to the '{1}' heading distribution point", publishWithCorrelationId, _distributionPointId); _headSubscribers.Add(publishWithCorrelationId, subscription); if (_headDistributionPointPaused) { _headDistributionPointPaused = false; _headDistributionPoint.Resume(); } }
public void setup() { _checkpointUnhandledBytesThreshold = 1000; Given(); _bus = new FakePublisher(); _projectionCorrelationId = Guid.NewGuid(); _eventHandler = new TestHandler<ProjectionSubscriptionMessage.CommittedEventReceived>(); _checkpointHandler = new TestHandler<ProjectionSubscriptionMessage.CheckpointSuggested>(); _progressHandler = new TestHandler<ProjectionSubscriptionMessage.ProgressChanged>(); _eofHandler = new TestHandler<ProjectionSubscriptionMessage.EofReached>(); _checkpointStrategy = CreateCheckpointStrategy(); _subscription = CreateProjectionSubscription(); When(); }
public bool TrySubscribe( Guid projectionId, IProjectionSubscription projectionSubscription, CheckpointTag fromCheckpointTag) { EnsureStarted(); if (_headSubscribers.ContainsKey(projectionId)) { throw new InvalidOperationException( string.Format("Projection '{0}' has been already subscribed", projectionId)); } if (projectionSubscription.CanJoinAt(_subscribeFromPosition, fromCheckpointTag)) { _logger.Trace("The '{0}' subscription has joined the heading distribution point at '{1}'", projectionId, fromCheckpointTag); DispatchRecentMessagesTo(projectionSubscription); AddSubscriber(projectionId, projectionSubscription); return(true); } return(false); }
public bool TrySubscribe( Guid projectionId, IProjectionSubscription projectionSubscription, long fromTransactionFilePosition) { EnsureStarted(); if (_headSubscribers.ContainsKey(projectionId)) { throw new InvalidOperationException( string.Format("Projection '{0}' has been already subscribed", projectionId)); } // if first available event commit position is before the safe TF (prepare) position - join if (_subscribeFromPosition.CommitPosition <= fromTransactionFilePosition) { _logger.Trace("The '{0}' subscription has joined the heading distribution point at '{1}'", projectionId, fromTransactionFilePosition); DispatchRecentMessagesTo(projectionSubscription); AddSubscriber(projectionId, projectionSubscription); return(true); } return(false); }
public bool TrySubscribe( Guid projectionId, IProjectionSubscription projectionSubscription, long fromTransactionFilePosition) { EnsureStarted(); if (_headSubscribers.ContainsKey(projectionId)) throw new InvalidOperationException( string.Format("Projection '{0}' has been already subscribed", projectionId)); // if first available event commit position is before the safe TF (prepare) position - join if (_subscribeFromPosition.CommitPosition <= fromTransactionFilePosition) { _logger.Trace("The '{0}' subscription has joined the heading distribution point at '{1}'", projectionId, fromTransactionFilePosition); DispatchRecentMessagesTo(projectionSubscription); AddSubscriber(projectionId, projectionSubscription); return true; } return false; }
public bool TrySubscribe( Guid projectionId, IProjectionSubscription projectionSubscription, CheckpointTag fromCheckpointTag) { EnsureStarted(); if (_headSubscribers.ContainsKey(projectionId)) throw new InvalidOperationException( string.Format("Projection '{0}' has been already subscribed", projectionId)); if (projectionSubscription.CanJoinAt(_subscribeFromPosition, fromCheckpointTag)) { _logger.Trace("The '{0}' subscription has joined the heading distribution point at '{1}'", projectionId, fromCheckpointTag); DispatchRecentMessagesTo(projectionSubscription); AddSubscriber(projectionId, projectionSubscription); return true; } return false; }