private async Task DoInitialization() { await _messageEndPoint.RegisterAsync(new DefaultHandlerFactory <CommandMessageBroker>()); await _messageEndPoint.RegisterAsync <RegisterCommandForwarding>(new DefaultHandlerFactory <CommandMessageBroker>()); await _messageEndPoint.RegisterAsync <UnregisterCommandForwarding>(new DefaultHandlerFactory <CommandMessageBroker>()); await _messageEndPoint.RegisterAsync(new DefaultHandlerFactory <QueryMessageBroker>()); await _messageEndPoint.RegisterAsync <RegisterQueryForwarding>(new DefaultHandlerFactory <QueryMessageBroker>()); await _messageEndPoint.RegisterAsync <UnregisterQueryForwarding>(new DefaultHandlerFactory <QueryMessageBroker>()); await _messageEndPoint.RegisterAsync <RegisterEventForwarding>(new DefaultHandlerFactory <EventMessageBroker>()); await _messageEndPoint.RegisterAsync <UnregisterEventForwarding>(new DefaultHandlerFactory <EventMessageBroker>()); await _messageEndPoint.RegisterAsync <DispatchEvent>(new DefaultHandlerFactory <EventMessageBroker>()); await _messageEndPoint.Initialization; var setupMessage = new SetupModule(); await _messageEndPoint.SendAsync(setupMessage); }
public Task RegisterForwardingAsync <TQuery>() { var message = new RegisterQueryForwarding(typeof(TQuery)); Console.WriteLine($"Sending 'RegisterQueryForwarding' for query type '{message.QueryType.FullName}'."); return(_messageEndPoint.SendAsync(message)); }
public Task RegisterForwardingAsync <TCommand>() { var message = new RegisterCommandForwarding(typeof(TCommand)); Console.WriteLine($"Sending 'RegisterCommandForwarding' for command type '{message.CommandType.FullName}'."); return(_messageEndPoint.SendAsync(message)); }
public Task RegisterForwardingAsync <TEvent>() { var message = new RegisterEventForwarding(typeof(TEvent)); Console.WriteLine($"Sending 'RegisterEventForwarding' for event type '{message.EventType.FullName}'."); return(_messageEndPoint.SendAsync(message)); }
public async Task <IEventResult> HandleAsync(TEvent evt) { if (evt == null) { throw new ArgumentNullException(nameof(evt)); } var message = new DispatchEvent(typeof(TEvent), evt); Console.WriteLine($"Sending 'DispatchEvent' for event type '{message.EventType.FullName}' with event '{message.Event}'."); var answer = await _messageEndPoint.SendAsync <DispatchEvent, EventDispatchResult>(message); return(answer.EventResult); }
public async Task <IQueryResult> HandleAsync(TQuery query) { if (query == null) { throw new ArgumentNullException(nameof(query)); } var message = new DispatchQuery(typeof(TQuery), query); Console.WriteLine($"Sending 'DispatchQuery' for query type '{message.QueryType.FullName}' with query '{message.Query}'."); var answer = await _messageEndPoint.SendAsync <DispatchQuery, QueryDispatchResult>(message); return(answer.QueryResult); }
public async Task <ICommandResult> HandleAsync(TCommand command) { if (command == null) { throw new ArgumentNullException(nameof(command)); } var message = new DispatchCommand(typeof(TCommand), command); Console.WriteLine($"Sending 'DispatchCommand' for command type '{message.CommandType.FullName}' with command '{message.Command}'."); var answer = await _messageEndPoint.SendAsync <DispatchCommand, CommandDispatchResult>(message); return(answer.CommandResult); }