Ejemplo n.º 1
0
        public async Task TestTransactionalPublishString_Commit()
        {
            using (var tx = new LocalTransaction())
            {
                await bus.PublishAsync(Event.Create("This should be committed!"));

                tx.Complete();
            }
        }
Ejemplo n.º 2
0
        public async Task TestPerformance_SingleCommit()
        {
            Stopwatch watch = Stopwatch.StartNew();

            using (var tx = new LocalTransaction())
            {
                for (int i = 0; i < 1000; i++)
                {
                    await bus.PublishAsync(Event.Create("hello world"));
                }
                tx.Complete();
            }
            Console.WriteLine($"Published 1000 messages in {watch.Elapsed}");
        }