Esempio n. 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();
                    }
                }
            }
        }
Esempio n. 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));
            }));
        }
Esempio n. 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());
            });
        }
Esempio n. 8
0
        // ReSharper disable InconsistentNaming


        static CqrsEngineHost BuildHost()
        {
            var builder = new CqrsEngineBuilder();

            builder.Azure(x => x.AddAzureProcess(AzureStorage.CreateConfigurationForDev(), "process-vip"));
            builder.Memory(x =>
            {
                x.AddMemoryProcess("process-all");
                x.AddMemoryRouter("inbox", e =>
                {
                    var isVip = e.Items.Any(i => i.MappedType == typeof(VipMessage));
                    return(isVip ? "azure-dev:process-vip" : "memory:process-all");
                });
                x.AddMemorySender("inbox", cm => cm.IdGeneratorForTests());
            });


            return(builder.Build());
        }
        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);
        }