Example #1
0
        public async Task Try_server_and_client_together_for_queries()
        {
            //can be an ioc bus too.
            var bus = new SimpleQueryBus();

            bus.Register(Assembly.GetExecutingAssembly());

            //takes care of execution
            var processor = new CqsMessageProcessor {
                QueryBus = bus
            };

            //receive through HTTP
            var server = new CqsHttpListener(processor);

            server.Map(typeof(GetUsers));
            server.Start(new IPEndPoint(IPAddress.Loopback, 0));

            //Our cqs HTTP client.
            var client = new CqsHttpClient("http://localhost:" + server.LocalPort);
            var result = await client.QueryAsync(new GetUsers { FirstName = "Jonas" });
        }
Example #2
0
        public async Task Try_server_and_client_together()
        {
            //can be an ioc bus too.
            var commandBus = new SimpleCommandBus();

            commandBus.Register(Assembly.GetExecutingAssembly());

            //takes care of execution
            var processor = new CqsMessageProcessor {
                CommandBus = commandBus
            };

            //receive through HTTP
            var server = new CqsHttpListener(processor);

            server.Map(typeof(RaiseHands));
            server.Start(new IPEndPoint(IPAddress.Loopback, 0));

            //Our cqs HTTP client.
            var client = new CqsHttpClient("http://localhost:" + server.LocalPort);
            await client.ExecuteAsync(new RaiseHands { Reason = "all YOUR base" });
        }