Beispiel #1
0
        /// <summary>
        /// Ctor with a key to lookup the configuration
        /// </summary>
        public RabbitConsumer()
        {
            var configModel = new ConnectionConfigModel
            {
                HostName    = HostName,
                UserName    = UserName,
                Password    = Password,
                QueueName   = QueueName,
                IsDurable   = IsDurable,
                VirtualHost = VirtualHost,
                Port        = Port,
            };

            // 显示配置
            EstablishConnection.DisplaySettings(configModel);
            // 连接到指定的Queue
            EstablishConnection.CreateConnection(configModel);
        }
 private void CheckActivePortCalledNumber(Port port, int callNumber)
 {
     if (IsDisableListContainsCalledNumber(callNumber))
     {
         UserIsUnavaliable?.Invoke(port, "User is unavaliable now. Please try again.");
     }
     else if (IsActiveListContainsCalledNumber(callNumber))
     {
         UserIsBusy?.Invoke(port, "User is busy. Please try again later.");
     }
     else if (IsEnabledListContainsCalledNumber(callNumber))
     {
         var port2 = EnabledPorts.FirstOrDefault(x => x.Number == callNumber);
         if (port2 != null)
         {
             EstablishConnection?.Invoke(this, new ConnectionEventArgs(port, port2));
         }
     }
     else
     {
         UserDoesntExists?.Invoke(port, "We're sorry, but user with this number doesn't exists.");
     }
 }