/// <summary>
 /// 生产者
 /// </summary>
 /// <param name="settings"></param>
 /// <param name="delayedMessageEnabled">延迟消息已启用(需启用插件 rabbitmq_delayed_message_exchange)</param>
 /// <param name="autoConfig">自动建Exchange和Bind</param>
 public Producer(ProducerSettings settings, bool delayedMessageEnabled, bool autoConfig)
 {
     if (settings == null)
     {
         throw new ArgumentNullException(nameof(settings));
     }
     if (settings.AmqpConnection == null && settings.AmqpUri == null)
     {
         throw new ArgumentNullException("AmqpConnection or AmqpUri must be set.");
     }
     _clientName = string.IsNullOrEmpty(settings.ClientName) ? "undefined producer client" : settings.ClientName;
     _amqpUri    = settings.AmqpUri;
     if (settings.AmqpConnection != null)
     {
         _amqpConnection = settings.AmqpConnection;
         _clientName     = settings.AmqpConnection.ClientProvidedName;
     }
     if (settings.SendMsgTimeout > 0)
     {
         _sendMsgTimeout = TimeSpan.FromSeconds(settings.SendMsgTimeout);
     }
     if (settings.MaxChannelIdleDuration > 0)
     {
         _maxIdleDuration = TimeSpan.FromSeconds(settings.MaxChannelIdleDuration);
     }
     _delayedMessageEnabled = delayedMessageEnabled;
     _autoConfig            = autoConfig;
     _channelPool           = new ConcurrentQueue <Tuple <DateTime, IRabbitMQChannel> >();
     _cleanIdleChannelTimer = new Timer(ClearIdleChannel);
 }
 /// <summary>
 /// 生产者
 /// </summary>
 /// <param name="settings"></param>
 /// <param name="delayedMessageEnabled">延迟消息已启用(需启用插件 rabbitmq_delayed_message_exchange)</param>
 public Producer(ProducerSettings settings, bool delayedMessageEnabled)
     : this(settings, delayedMessageEnabled, true)
 {
 }
 /// <summary>
 /// 生产者
 /// </summary>
 /// <param name="settings"></param>
 public Producer(ProducerSettings settings)
     : this(settings, false, true)
 {
 }