Ejemplo n.º 1
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="CqsHttpListener" /> class.
 /// </summary>
 /// <param name="messageProcessor">Used to execute the actual messages.</param>
 public CqsWebSocketServer(CqsMessageProcessor messageProcessor)
 {
     if (messageProcessor == null)
     {
         throw new ArgumentNullException("messageProcessor");
     }
     _messageProcessor = messageProcessor;
 }
Ejemplo n.º 2
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="CqsHttpListener" /> class.
 /// </summary>
 /// <param name="messageProcessor">Used to execute the actual messages.</param>
 public CqsHttpListener(CqsMessageProcessor messageProcessor)
 {
     if (messageProcessor == null)
     {
         throw new ArgumentNullException("messageProcessor");
     }
     _messageProcessor = messageProcessor;
 }
 public CqsController(IQueryBus queryBus, IRequestReplyBus requestReplyBus, ICommandBus commandBus,
                      IEventBus eventBus)
 {
     _cqsProcessor = new CqsMessageProcessor
     {
         CommandBus      = commandBus,
         RequestReplyBus = requestReplyBus,
         EventBus        = eventBus,
         QueryBus        = queryBus
     };
 }
Ejemplo n.º 4
0
        private static CqsHttpListener CreateServer()
        {
            //can be an ioc bus too.
            var commandBus = new SimpleCommandBus();

            commandBus.Register(Assembly.GetExecutingAssembly());

            var queryBus = new SimpleQueryBus();

            queryBus.Register(Assembly.GetExecutingAssembly());

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

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

            return(server);
        }
Ejemplo n.º 5
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" });
        }
Ejemplo n.º 6
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" });
        }
Ejemplo n.º 7
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="CqsHttpListener" /> class.
 /// </summary>
 /// <param name="messageProcessor">Used to execute the actual messages.</param>
 public CqsWebSocketServer(CqsMessageProcessor messageProcessor)
 {
     if (messageProcessor == null) throw new ArgumentNullException("messageProcessor");
     _messageProcessor = messageProcessor;
 }
Ejemplo n.º 8
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="CqsHttpListener" /> class.
 /// </summary>
 /// <param name="messageProcessor">Used to execute the actual messages.</param>
 public CqsHttpListener(CqsMessageProcessor messageProcessor)
 {
     if (messageProcessor == null) throw new ArgumentNullException("messageProcessor");
     _messageProcessor = messageProcessor;
 }