private void SetUp()
 {
     _connectionSettings = ConnectionSettings.Instance("127.0.0.1", 5672, "rabbitMQSamples", "colin", "123456");
     _phoneNumberExecutive = new PhoneNumberExecutive(_connectionSettings);
     _phoneNumberFinder = new PhoneNumberFinder(_connectionSettings);
     _matchtedPhoneNumberCounter = new MatchtedPhoneNumberCounter(_connectionSettings);
     _totalPhoneNumbersCounter = new TotalPhoneNumbersCounter(_connectionSettings);
 }
        protected BrokerChannel(ConnectionSettings connectionSettings, string name)
        {
            this.Name = name;
            ConnectionFactory factory = this.ConfigureConnectionFactoryUsing(connectionSettings);

            this._connection = factory.CreateConnection();
            this.Channel = this._connection.CreateModel();
        }
        public Queue(ConnectionSettings connectionSettings, string name, bool durable, bool exclusive, bool autoDeleted)
            : base(connectionSettings)
        {
            this.Durable = durable;

            QueueDeclareOk result = this.Channel.QueueDeclare(name, durable, exclusive, autoDeleted, null);

            this.Name = result.QueueName;
        }
 public static Queue DurableInstance(ConnectionSettings connectionSettings, string name)
 {
     return new Queue(connectionSettings, name, true, false, false);
 }
 public static Queue Create(ConnectionSettings connectionSettings, string name, bool durable, bool exclusive,
     bool autoDeleted)
 {
     return new Queue(connectionSettings, name, durable, exclusive, autoDeleted);
 }
 public static Queue Create(ConnectionSettings connectionSettings, string name)
 {
     return new Queue(connectionSettings, name, false, false, false);
 }
 public MatchtedPhoneNumberCounter(ConnectionSettings connectionSettings)
     : base(connectionSettings)
 {
 }
 public TotalPhoneNumbersCounter(ConnectionSettings connectionSettings)
     : base(connectionSettings)
 {
 }
 public PhoneNumberFinder(ConnectionSettings connectionSettings)
     : base(connectionSettings)
 {
 }
 public PhoneNumberExecutive(ConnectionSettings connectionSettings)
     : base(connectionSettings)
 {
     this._processes = new Dictionary<string, PhoneNumberProcess>();
 }
 protected ExchangeListener(ConnectionSettings connectionSettings)
 {
     this._connectionSettings = connectionSettings;
     this.AttachToQueue();
     this.RegisterConsumer();
 }
        protected ConnectionFactory ConfigureConnectionFactoryUsing(ConnectionSettings connectionSettings)
        {
            ConnectionFactory factory = new ConnectionFactory();

            factory.HostName = connectionSettings.HostName;

            if(connectionSettings.HasPort()) {
                factory.Port = connectionSettings.Port;
            }

            factory.VirtualHost = connectionSettings.VirtualHost;

            if(connectionSettings.HasUserCredentials()) {
                factory.UserName = connectionSettings.UserName;
                factory.Password = connectionSettings.Password;
            }

            return factory;
        }
 protected BrokerChannel(ConnectionSettings connectionSettings)
     : this(connectionSettings, null)
 {
 }