public void Akka_Persistence_event_log_must_provide_a_flow_with_an_input_port_for_writing_events_and_and_output_port_for_delivering_replayed_and_live_events()
        {
            var pid = "2";
            var events1 = new[] { "a", "b", "c" }.Select(x => new Emitted <string>(x, EmitterId)).ToArray();
            var events2 = new[] { "d", "e", "f" }.Select(x => new Emitted <string>(x, EmitterId)).ToArray();
            var expected = Durables(events1, offset: 1)
                           .Select(x => (Delivery <Durable <string> >) new Delivered <Durable <string> >(x))
                           .ToImmutableList()
                           .Add(Recovered <Durable <string> > .Instance)
                           .AddRange(Durables(events2, offset: 4)
                                     .Select(x => (Delivery <Durable <string> >) new Delivered <Durable <string> >(x)));

            Source.From(events1).RunWith(_eventLog.Sink <string>(pid), Materializer).Wait(Timeout).Should().BeTrue();
            var t = Source.From(events2).Via(_eventLog.Flow <string>(pid)).RunWith(Sink.Seq <Delivery <Durable <string> > >(), Materializer);

            t.Wait(Timeout).Should().BeTrue();
            t.Result.ShouldAllBeEquivalentTo(expected);
        }
Exemplo n.º 2
0
 private Flow <IRequest, Response, NotUsed> Processor(string emitterId) =>
 EventSourcing.Create(emitterId, 0, RequestHandler, EventHandler).Join(_eventLog.Flow <IEvent>(emitterId));