public CqsController(IQueryBus queryBus, IRequestReplyBus requestReplyBus, ICommandBus commandBus,
                      IEventBus eventBus)
 {
     _cqsProcessor = new CqsMessageProcessor
     {
         CommandBus      = commandBus,
         RequestReplyBus = requestReplyBus,
         EventBus        = eventBus,
         QueryBus        = queryBus
     };
 }
Пример #2
0
 /// <summary>
 ///     Route requests using a custom rule.
 /// </summary>
 /// <param name="rule">The rule.</param>
 /// <param name="destination">The destination to invoke if the rule accepts the CQS object.</param>
 /// <exception cref="System.ArgumentNullException">
 ///     rule
 ///     or
 ///     destination
 /// </exception>
 public void RouteRequests(IRoutingRule rule, IRequestReplyBus destination)
 {
     if (rule == null)
     {
         throw new ArgumentNullException("rule");
     }
     if (destination == null)
     {
         throw new ArgumentNullException("destination");
     }
     _requestRoutes.Add(new RoutedRequestReplyBus(rule, destination));
 }
Пример #3
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="CqsServer" /> class.
        /// </summary>
        public CqsServer(ICommandBus commandBus, IQueryBus queryBus, IEventBus eventBus,
                         IRequestReplyBus requestReplyBus)
        {
            _commandBus      = commandBus;
            _queryBus        = queryBus;
            _eventBus        = eventBus;
            _requestReplyBus = requestReplyBus;

            var config = new ChannelTcpListenerConfiguration(CreateDecoder, CreateEncoder);

            _listener = new ChannelTcpListener(config);
            _listener.MessageReceived = OnClientMessage;
            _requestMethod            = GetType().GetMethod("ExecuteRequest", BindingFlags.NonPublic | BindingFlags.Instance);
            _commandMethod            = GetType().GetMethod("ExecuteCommand", BindingFlags.NonPublic | BindingFlags.Instance);
            _queryMethod = GetType().GetMethod("ExecuteQuery", BindingFlags.NonPublic | BindingFlags.Instance);
        }
 public AccountController(ICommandBus commandBus, IQueryBus queryBus, IRequestReplyBus requestReplyBus)
 {
     _commandBus      = commandBus;
     _queryBus        = queryBus;
     _requestReplyBus = requestReplyBus;
 }
Пример #5
0
 /// <summary>
 ///     Routes requests that are declared in the specified assembly.
 /// </summary>
 /// <param name="assembly">The assembly.</param>
 /// <param name="destination">The destination.</param>
 public void RouteRequests(Assembly assembly, IRequestReplyBus destination)
 {
     _requestRoutes.Add(new RoutedRequestReplyBus(new AssemblyRule(assembly), destination));
 }
Пример #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RoutedCommandBus"/> class.
 /// </summary>
 /// <param name="routingRule">The routing rule.</param>
 /// <param name="inner">Bus to invoke request on if the rule accepts the request.</param>
 public RoutedRequestReplyBus(IRoutingRule routingRule, IRequestReplyBus inner)
 {
     _routingRule = routingRule;
     _inner       = inner;
 }