public async Task send_end_to_end() { var item = new ItemCreated { Name = "Hat", Id = Guid.NewGuid() }; var waiter = theTracker.WaitFor <ItemCreated>(); await theSender.Messaging.Send(item); waiter.Wait(20.Seconds()); waiter.IsCompleted.ShouldBeTrue(); using (var session = theReceiver.Get <IDocumentStore>().QuerySession()) { var item2 = session.Load <ItemCreated>(item.Id); if (item2 == null) { Thread.Sleep(500); item2 = session.Load <ItemCreated>(item.Id); } item2.Name.ShouldBe("Hat"); } var admin = theReceiver.Get <IEnvelopePersistence>().Admin; (await admin.AllIncomingEnvelopes()).Any().ShouldBeFalse(); }
public async Task enqueue_locally() { var item = new ItemCreated { Name = "Shoe", Id = Guid.NewGuid() }; var waiter = theTracker.WaitFor <ItemCreated>(); await theReceiver.Messaging.Enqueue(item); waiter.Wait(5.Seconds()); waiter.IsCompleted.ShouldBeTrue(); var documentStore = theReceiver.Get <IDocumentStore>(); using (var session = documentStore.QuerySession()) { var item2 = session.Load <ItemCreated>(item.Id); if (item2 == null) { Thread.Sleep(500); item2 = session.Load <ItemCreated>(item.Id); } item2.Name.ShouldBe("Shoe"); } var incoming = await theReceiver.Get <IEnvelopePersistence>().Admin.AllIncomingEnvelopes(); incoming.Any().ShouldBeFalse(); }
public async Task enqueue_locally() { var item = new ItemCreated { Name = "Shoe", Id = Guid.NewGuid() }; await theReceiver.ExecuteAndWait(c => c.Enqueue(item)); var documentStore = theReceiver.Get <IDocumentStore>(); using (var session = documentStore.QuerySession()) { var item2 = session.Load <ItemCreated>(item.Id); if (item2 == null) { Thread.Sleep(500); item2 = session.Load <ItemCreated>(item.Id); } item2.Name.ShouldBe("Shoe"); } var incoming = await theReceiver.Get <IEnvelopePersistence>().Admin.AllIncomingEnvelopes(); incoming.Any().ShouldBeFalse(); }
public async Task send_end_to_end() { var item = new ItemCreated { Name = "Hat", Id = Guid.NewGuid() }; await theSender .TrackActivity() .AlsoTrack(theReceiver) // In case there are trash, leftover persisted messages .DoNotAssertOnExceptionsDetected() .SendMessageAndWait(item); using (var session = theReceiver.Get <IDocumentStore>().QuerySession()) { var item2 = session.Load <ItemCreated>(item.Id); if (item2 == null) { Thread.Sleep(500); item2 = session.Load <ItemCreated>(item.Id); } item2.Name.ShouldBe("Hat"); } var admin = theReceiver.Get <IEnvelopePersistence>().Admin; (await admin.AllIncomingEnvelopes()).Any().ShouldBeFalse(); }
public async Task delete_all_persisted_envelopes() { var item = new ItemCreated { Name = "Shoe", Id = Guid.NewGuid() }; await theSender.Messaging.Schedule(item, 1.Days()); var persistor = theSender.Get <IEnvelopePersistence>(); var counts = await persistor.Admin.GetPersistedCounts(); counts.Scheduled.ShouldBe(1); persistor.Admin.ClearAllPersistedEnvelopes(); (await persistor.Admin.GetPersistedCounts()).Scheduled.ShouldBe(0); }
public static void Handle(ItemCreated created, IDocumentSession session, Envelope envelope) { session.Store(created); }
public static void Handle(ItemCreated created, IDocumentSession session, MessageTracker tracker, Envelope envelope) { session.Store(created); tracker.Record(created, envelope); }