Example #1
0
        public RabbitMQEventBus(IRabbitMQOptions 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();
        }
Example #2
0
 public RabbitMQEventBus(IRabbitMQOptions options) : this(options, new DefaultEventHandlerTypeStore(),
                                                          new ActivatorHandlerFactory())
 {
 }