Exemple #1
0
 public static void DisplaySettings(ConnectionConfigModel coneConfigModel)
 {
     Console.WriteLine("Host: {0}", coneConfigModel.HostName);
     Console.WriteLine("Username: {0}", coneConfigModel.UserName);
     Console.WriteLine("Password: {0}", coneConfigModel.Password);
     Console.WriteLine("QueueName: {0}", coneConfigModel.QueueName);
     Console.WriteLine("VirtualHost: {0}", coneConfigModel.VirtualHost);
     Console.WriteLine("Port: {0}", coneConfigModel.Port);
     Console.WriteLine("Is Durable: {0}", coneConfigModel.IsDurable);
 }
Exemple #2
0
        public static void CreateConnection(ConnectionConfigModel coneConfigModel)
        {
            _connectionFactory = new ConnectionFactory
            {
                HostName = coneConfigModel.HostName,
                UserName = coneConfigModel.UserName,
                Password = coneConfigModel.Password,
            };

            if (string.IsNullOrEmpty(coneConfigModel.VirtualHost) == false)
            {
                _connectionFactory.VirtualHost = coneConfigModel.VirtualHost;
            }
            if (coneConfigModel.Port > 0)
            {
                _connectionFactory.Port = coneConfigModel.Port;
            }
            _connection = _connectionFactory.CreateConnection();
            _model      = _connection.CreateModel();
            _model.BasicQos(0, 1, false);
            _subscription = new Subscription(_model, coneConfigModel.QueueName, false);
        }