public CheckpointProjection( IStatefulProjection inner, CheckpointStore checkpointStore, Action <AllStreamPosition> notifyCheckpoint = null) { _inner = inner; _checkpointStore = checkpointStore; _notifyCheckpoint = notifyCheckpoint; _lastCheckpoint = _checkpointStore.Read(); _notifyCheckpoint?.Invoke(AllStreamPosition.FromNullableInt64(_lastCheckpoint)); }
public static IStatefulProjection Wrap( ProjectionGroupStateObserver observer, string name, IStatefulProjection projection) => new StatefulProjectionBuilder(projection) .Use(projectMidfunc: downstream => async(message, ct) => { if (observer[name].Checkpoint >= message.Checkpoint) { return; } await downstream(message, ct).ConfigureAwait(false); observer.MoveTo(name, message.Checkpoint); }) .UseSuspendOnException(ex => observer.Suspend(name, ex)) .Build();
public StatefulProjectionBuilder(IStatefulProjection projection = null) =>
private IStatefulProjection WrapLocalProjection(string name, IStatefulProjection projection) => new StatefulProjectionBuilder(projection) .UseCheckpointStore(CheckpointsGroup.GetCheckpointStore(name), cp => Observer.MoveTo(name, cp)) .UseCommitEvery() .UseSuspendOnException(ex => Observer.Suspend(name, ex)) .Build();
public static IStatefulProjection Combine(IStatefulProjection projection, Action <Envelope> project = null, Action commit = null) => Combine(projection, new DelegateProjection((m, ct) => Async(() => project?.Invoke(m)), _ => Async(commit)));
public CommitNthProjection(IStatefulProjection inner, int maxBatchSize = 2048) { _inner = inner; _maxBatchSize = maxBatchSize; }
public SuspendableProjection(IStatefulProjection inner, Action <Exception> onSuspend = null) { _inner = inner; _onSuspend = onSuspend; }