示例#1
0
        static void Main(string[] args)
        {
            var eventAggregator = new EventAggregator <Message>();
            var projectionHost  = new ProjectionHost(eventAggregator);

            projectionHost.SetUpProjections();

            var inMemQueue = new InMemQueue <Message>();
            var reader     = new QueueReader <Message>(inMemQueue);

            eventAggregator.AttachTo(reader);

            var foo = new QueueWriter <Message>(inMemQueue);

            reader.Start();
            while (true)
            {
                foo.Handle(new FooMessage());
                Thread.Sleep(1000);
            }

            //var dispatcher = new ByTypeDispatcher();
            //dispatcher.Subscribe(new FooHandler());
            //dispatcher.Handle(new FooMessage());
        }