コード例 #1
0
        public RabbitMQEventDispatcher(RabbitMQOptions options, IEventHandlerTypeStore eventHandlerTypeStore,
                                       IHandlerFactory handlerFactory) : base(eventHandlerTypeStore, handlerFactory)

        {
            _options   = options;
            _modelDict = new ConcurrentDictionary <string, IModel>();

            var connectionFactory = new ConnectionFactory
            {
                HostName = _options.HostName,

                DispatchConsumersAsync = true
            };

            if (_options.Port > 0)
            {
                connectionFactory.Port = _options.Port;
            }

            if (!string.IsNullOrWhiteSpace(_options.UserName))
            {
                connectionFactory.UserName = _options.UserName;
            }

            if (!string.IsNullOrWhiteSpace(_options.Password))
            {
                connectionFactory.Password = _options.Password;
            }

            _connection = connectionFactory.CreateConnection();
        }
コード例 #2
0
 public EventDispatcher(IEventHandlerTypeStore eventHandlerTypeStore,
                        IHandlerFactory handlerFactory)
 {
     _handlerFactory        = handlerFactory;
     _eventHandlerTypeStore = eventHandlerTypeStore ?? new EventHandlerTypeStore();
 }
コード例 #3
0
ファイル: EventBus.cs プロジェクト: zlzforever/EventBus
 public EventBus(IEventHandlerTypeStore eventHandlerTypeStore,
                 IHandlerFactory handlerFactory)
 {
     _handlerFactory        = handlerFactory;
     _eventHandlerTypeStore = eventHandlerTypeStore;
 }