Ejemplo n.º 1
0
        public void Bug80_CurrentEventsByTag_should_Recover_until_end()
        {
            var actor    = Sys.ActorOf(TagActor.Props("y"));
            var msgCount = 1200;

            actor.Tell(msgCount);
            ExpectMsg($"{msgCount}-done", TimeSpan.FromSeconds(20));

            var eventsByTag = ReadJournal.CurrentEventsByTag(typeof(RealMsg).Name)
                              .RunForeach(e => TestActor.Tell(e), Materializer);

            ReceiveN(msgCount);
        }
Ejemplo n.º 2
0
        public void Bug80_CurrentEventsByTag_should_Recover_until_end()
        {
            var actor = Sys.ActorOf(TagActor.Props("y"));
            //increased this to test for non-collision with the generated timestamps
            var msgCount = 5000;

            actor.Tell(msgCount);
            ExpectMsg($"{msgCount}-done", TimeSpan.FromSeconds(20));

            var eventsByTag = ReadJournal.CurrentEventsByTag(typeof(RealMsg).Name)
                              .RunForeach(e => TestActor.Tell(e), Materializer);

            ReceiveN(msgCount);
        }
Ejemplo n.º 3
0
        public async Task Bug61_Events_Recovered_By_Id_Should_Match_Tag()
        {
            var actor = Sys.ActorOf(TagActor.Props("x"));

            actor.Tell(MessageCount);
            ExpectMsg($"{MessageCount}-done", TimeSpan.FromSeconds(20));

            var eventsById = await ReadJournal.CurrentEventsByPersistenceId("x", 0L, long.MaxValue)
                             .RunAggregate(ImmutableHashSet <EventEnvelope> .Empty, (agg, e) => agg.Add(e), Materializer);

            eventsById.Count.Should().Be(MessageCount);

            var eventsByTag = await ReadJournal.CurrentEventsByTag(typeof(RealMsg).Name)
                              .RunAggregate(ImmutableHashSet <EventEnvelope> .Empty, (agg, e) => agg.Add(e), Materializer);

            eventsByTag.Count.Should().Be(MessageCount);

            eventsById.All(x => x.Event is RealMsg).Should().BeTrue("Expected all events by id to be RealMsg");
            eventsByTag.All(x => x.Event is RealMsg).Should().BeTrue("Expected all events by tag to be RealMsg");
        }
Ejemplo n.º 4
0
        public void Bug80_AllEventsByTag_should_Recover_all_messages()
        {
            var actor    = Sys.ActorOf(TagActor.Props("y"));
            var msgCount = 1200;

            actor.Tell(msgCount);
            ExpectMsg($"{msgCount}-done", TimeSpan.FromSeconds(20));

            var eventsByTag = ReadJournal.EventsByTag(typeof(RealMsg).Name)
                              .RunForeach(e => TestActor.Tell(e), Materializer);

            // can't do this because Offset isn't IComparable
            // ReceiveN(msgCount).Cast<EventEnvelope>().Select(x => x.Offset).Should().BeInAscendingOrder();
            ReceiveN(msgCount);

            // should receive more messages after the fact
            actor.Tell(msgCount);
            ExpectMsg($"{msgCount}-done", TimeSpan.FromSeconds(20));
            ReceiveN(msgCount);
        }