protected virtual IConnectionFactory CreateFactory(IRabbitSessionConfiguration config)
        {
            var connectionStrs = config.ExchangeUrl.Split(':');

            return(new ConnectionFactory
            {
                UserName = config.UserName,
                Password = config.Password,
                HostName = connectionStrs[0],
                Port = int.Parse(connectionStrs[1]),
                VirtualHost = config.vHost,
            });
        }
Exemplo n.º 2
0
        public RabbitReceiver(IConnectionFactory conn, IRabbitSessionConfiguration config, bool isTopic = false)
        {
            _isTopic = isTopic;

            // Binding to fields to keep _config from getting everywhere.
            _exchange     = config.Exchange;
            _exchangeType = config.ExchangeType;
            _queueName    = config.QueueName;
            _routingKey   = config.RoutingKey;
            _maxRequests  = config.MaxRequests;
            _autoAck      = config.AutoAcknowledge;
            _name         = config.Name;

            _connection = conn.CreateConnection();
        }