Exemplo n.º 1
0
 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();
Exemplo n.º 2
0
 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();