public void Handle(ProjectionSubscriptionMessage.CheckpointSuggested message) { if (IsOutOfOrderSubscriptionMessage(message)) { return; } RegisterSubscriptionMessage(message); EnsureState( State.Running | State.Paused | State.Stopping | State.Stopped | State.FaultedStopping | State.Faulted); try { if ((_state == State.Running || _state == State.Paused) && _projectionConfig.CheckpointsEnabled) { CheckpointTag checkpointTag = message.CheckpointTag; var checkpointSuggestedWorkItem = new CheckpointSuggestedWorkItem(this, message, _checkpointManager); _processingQueue.EnqueueTask(checkpointSuggestedWorkItem, checkpointTag); } _processingQueue.ProcessEvent(); } catch (Exception ex) { SetFaulted(ex); } }
public void SetCurrentCheckpointSuggestedWorkItem(CheckpointSuggestedWorkItem checkpointSuggestedWorkItem) { if (_checkpointSuggestedWorkItem != null && checkpointSuggestedWorkItem != null) throw new InvalidOperationException("Checkpoint in progress"); if (_checkpointSuggestedWorkItem == null && checkpointSuggestedWorkItem == null) throw new InvalidOperationException("No checkpoint in progress"); _checkpointSuggestedWorkItem = checkpointSuggestedWorkItem; }
private void CompleteCheckpointSuggestedWorkItem() { var workItem = _checkpointSuggestedWorkItem; if (workItem != null) { _checkpointSuggestedWorkItem = null; workItem.CheckpointCompleted(); EnsureTickPending(); } }
public void Handle(EventReaderSubscriptionMessage.CheckpointSuggested message) { if (IsOutOfOrderSubscriptionMessage(message)) { return; } RegisterSubscriptionMessage(message); try { if (_useCheckpoints) { CheckpointTag checkpointTag = message.CheckpointTag; var checkpointSuggestedWorkItem = new CheckpointSuggestedWorkItem(this, message, _checkpointManager); _processingQueue.EnqueueTask(checkpointSuggestedWorkItem, checkpointTag, allowCurrentPosition: true); } ProcessEvent(); } catch (Exception ex) { _coreProjection.SetFaulted(ex); } }
public void SetCurrentCheckpointSuggestedWorkItem(CheckpointSuggestedWorkItem checkpointSuggestedWorkItem) { _coreProjection.SetCurrentCheckpointSuggestedWorkItem(checkpointSuggestedWorkItem); }