/// <summary> /// ProducerClient构造函数 /// </summary> /// <param name="config">Producer配置对象</param> /// <param name="hosts">ProducerServer地址URI,以","分隔</param> /// <param name="weights">ProducerServer权重,以","分隔,数量需与hosts一致,范围[0-10]</param> public ProducerClient(ProducerConfig config, string hosts, string weights) { if (config == null) this.config = new ProducerConfig(); else this.config = config; Console.WriteLine(this.config); delay = new DelayStrategy(this.config.DelayBase, this.config.DelayMultiple); GenerateHostAndWeight(hosts, weights); ConnectToServers(); new Thread(new ThreadStart(RecoveryProc)).Start(); }
public ProducerClient(ProducerConfig config, string hosts) : this(config, hosts, null) { }