Esempio n. 1
0
        public void given_empty_when_write_message()
        {
            var write  = Message.Create("test", RandBytes(200));
            var result = Writer.Append(new[] { write });

            Assert.AreNotEqual(0, result.Position);
            Assert.AreEqual(result.Position, Writer.GetPosition());
            Assert.AreEqual(result.Position, CheckpointReader.Read());
        }
Esempio n. 2
0
        public async Task <IProjection> Create(Type type)
        {
            var pi   = GetProjectionInfo(type);
            var proj = new Projection();

            proj.Name = pi.Name;
            proj.SubscriptionStreamName = pi.SubscriptionStreamName;
            ICheckpointReader cr = Provider.GetRequiredService <ICheckpointReader>();

            proj.Checkpoint = await cr.Read($"Checkpoints-{proj.Name}");

            ICheckpointWriter cw = Provider.GetRequiredService <ICheckpointWriter>();

            proj.CheckpointWriter = cw;
            proj.Subscription     = CreateSubscription(proj);
            proj.Handlers         = GetHandlers(type);
            return(proj);
        }
Esempio n. 3
0
 public long GetPosition()
 {
     return(Position.Read());
 }