コード例 #1
0
        public void PartitionWithRouter()
        {
            var config = new MemoryStorageConfig();
            var raw = new RawEngineBuilder();

            var inWriter = config.CreateQueueWriter("in");
            var doWriter = config.CreateQueueWriter("do");

            // forwarder in => do
            raw.Dispatch(config.CreateInbox("in"), envelope => doWriter.PutMessage(envelope));
            // forwarder do => in
            raw.Dispatch(config.CreateInbox("do"), envelope => inWriter.PutMessage(envelope));

            TestConfiguration(inWriter, raw);
        }
コード例 #2
0
        public void PartitionWithRouter()
        {
            var config = new MemoryStorageConfig();
            var raw    = new CqrsEngineBuilder(EnvelopeStreamer.CreateDefault());

            var inWriter = config.CreateQueueWriter("in");
            var doWriter = config.CreateQueueWriter("do");

            // forwarder in => do
            raw.Dispatch(config.CreateInbox("in"), doWriter.PutMessage);
            // forwarder do => in
            raw.Dispatch(config.CreateInbox("do"), inWriter.PutMessage);


            TestConfiguration(inWriter, raw);
        }
コード例 #3
0
        public void RouterChain()
        {
            var config   = new MemoryStorageConfig();
            var raw      = new CqrsEngineBuilder(EnvelopeStreamer.CreateDefault());
            var doWriter = config.CreateQueueWriter("do");

            var route1 = config.CreateQueueWriter("route1");
            var route2 = config.CreateQueueWriter("route2");

            // in => (route1 OR route2)
            raw.Dispatch(config.CreateInbox("in"), bytes => LoadBalance(bytes, route1, route2));
            // forwarder (route1,route2) => do
            raw.Dispatch(config.CreateInbox("route1", "route2"), doWriter.PutMessage);

            raw.Dispatch(config.CreateInbox("do"), bytes => LoadBalance(bytes, route1, route2));
            TestConfiguration(config.CreateQueueWriter("in"), raw);
        }
コード例 #4
0
        public void RouterChain()
        {
            var config = new MemoryStorageConfig();
            var raw = new RawEngineBuilder();
            var doWriter = config.CreateQueueWriter("do");

            var route1 = config.CreateQueueWriter("route1");
            var route2 = config.CreateQueueWriter("route2");

            // in => (route1 OR route2)
            raw.Dispatch(config.CreateInbox("in"), bytes => LoadBalance(bytes, route1, route2));
            // forwarder (route1,route2) => do
            raw.Dispatch(config.CreateInbox("route1", "route2"), envelope => doWriter.PutMessage(envelope));

            raw.Dispatch(config.CreateInbox("do"), bytes => LoadBalance(bytes, route1, route2));
            TestConfiguration(config.CreateQueueWriter("in"), raw);
        }
コード例 #5
0
        public void Direct()
        {
            var config = new MemoryStorageConfig();
            var raw = new CqrsEngineBuilder(EnvelopeStreamer.CreateDefault());
            var doWriter = config.CreateQueueWriter("do");

            // forwarder do => do
            raw.Dispatch(config.CreateInbox("do"), doWriter.PutMessage);
            TestConfiguration(doWriter, raw);
        }
コード例 #6
0
        public void Memory_lambda()
        {
            var config = new MemoryStorageConfig();
            var writer = config.CreateQueueWriter("test");
            var inbox = config.CreateInbox("test");

            var builder = new CqrsEngineBuilder(null);
            builder.Dispatch(inbox, bytes => { });

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

            TestConfiguration(setup, 1000000);
        }
コード例 #7
0
        public void Memory_lambda()
        {
            var config = new MemoryStorageConfig();
            var writer = config.CreateQueueWriter("test");
            var inbox  = config.CreateInbox("test");

            var builder = new CqrsEngineBuilder(null);

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

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

            TestConfiguration(setup, 1000000);
        }