Пример #1
0
        public void Test()
        {
            using (var source = new CancellationTokenSource())
            {
                var dev = AzureStorage.CreateConfigurationForDev();
                WipeAzureAccount.Fast(s => s.StartsWith("test-"), dev);
                var b = new CqrsEngineBuilder(null);
                b.Dispatch(dev.CreateInbox("test-publish"), bytes =>
                {
                    if (bytes[0] == 42)
                    {
                        source.Cancel();
                    }
                });


                using (var engine = b.Build())
                {
                    var task = engine.Start(source.Token);

                    dev.CreateQueueWriter("test-publish").PutMessage(new byte[] { 42 });
                    if (!task.Wait(5000))
                    {
                        source.Cancel();
                    }
                }
            }
        }
Пример #2
0
        public void Test()
        {
            var dev = AzureStorage.CreateConfigurationForDev();

            WipeAzureAccount.Fast(s => s.StartsWith("test-"), dev);

            var events = new Subject <ISystemEvent>();
            var b      = new CqrsEngineBuilder();

            b.Azure(c => c.AddAzureProcess(dev, "test-publish"));
            b.Advanced.RegisterObserver(events);
            var engine = b.Build();
            var source = new CancellationTokenSource();

            engine.Start(source.Token);



            var builder = new CqrsClientBuilder();

            builder.Azure(c => c.AddAzureSender(dev, "test-publish"));
            var client = builder.Build();


            client.Sender.SendOne(new Message());

            using (engine)
                using (events.OfType <EnvelopeAcked>().Subscribe(e => source.Cancel()))
                {
                    source.Token.WaitHandle.WaitOne(5000);
                    source.Cancel();
                }
        }
        public void Throughput_Azure_lambda()
        {
            var config = AzureStorage.CreateConfigurationForDev();

            WipeAzureAccount.Fast(s => s.StartsWith("throughput"), config);
            TestConfiguration(c => c.Azure(m =>
            {
                m.AddAzureSender(config, "throughput");
                m.AddAzureProcess(config, "throughput", x => x.DispatcherIsLambda(Factory));
            }), 100);
        }
        public void Throughput_Azure_polymorphic()
        {
            var config = AzureStorage.CreateConfigurationForDev();

            WipeAzureAccount.Fast(s => s.StartsWith("throughput"), config);
            TestConfiguration(c => c.Azure(m =>
            {
                m.AddAzureSender(config, "throughput");
                m.AddAzureProcess(config, "throughput");
            }), 100);
        }
        public void Azure_partition_with_polymorphic()
        {
            var config = AzureStorage.CreateConfigurationForDev();

            WipeAzureAccount.Fast(s => s.StartsWith("performance"), config);
            TestConfiguration(c => c.Azure(m =>
            {
                m.AddAzureSender(config, "performance");
                m.AddAzureProcess(config, "performance");
            }));
        }
        public void Azure_partition_with_lambda()
        {
            var config = AzureStorage.CreateConfigurationForDev();

            WipeAzureAccount.Fast(s => s.StartsWith("performance"), config);
            TestConfiguration(c => c.Azure(m =>
            {
                m.AddAzureSender(config, "performance");
                m.AddAzureProcess(config, "performance", x => x.DispatcherIsLambda(Factory));
            }));
        }
Пример #7
0
        protected override void CurrentConfig(CqrsEngineBuilder b)
        {
            var dev = AzureStorage.CreateConfigurationForDev();

            WipeAzureAccount.Fast(s => s.StartsWith("test-"), dev);
            b.Azure(m =>
            {
                m.AddAzureProcess(dev, new[] { "test-incoming" }, c =>
                {
                    c.QueueVisibility(1);
                    c.DispatchAsCommandBatch();
                });
                m.AddAzureSender(dev, "test-incoming", x => x.IdGeneratorForTests());
            });
        }
        public void Throughput_Azure_lambda()
        {
            var config = AzureStorage.CreateConfigurationForDev();

            WipeAzureAccount.Fast(s => s.StartsWith("throughput"), config);

            var writer  = config.CreateQueueWriter("test");
            var inbox   = config.CreateInbox("test", u => TimeSpan.Zero);
            var builder = new CqrsEngineBuilder(null);

            builder.Dispatch(inbox, bytes => { });

            var setup = new Setup
            {
                Send   = i => writer.PutMessage(new[] { i }),
                Engine = builder.Build()
            };

            TestConfiguration(setup, 100);
        }