コード例 #1
0
 public Option(params Uri[] brokerUris)
 {
     if (brokerUris == null || brokerUris.Length == 0)
     {
         throw new ArgumentOutOfRangeException("brokerUris");
     }
     _brokerUris       = brokerUris;
     ProducerConfig    = ProducerConfig.Default;
     ConsumerConfig    = ConsumerConfig.Default;
     CoordinatorConfig = CoordinatorConfig.Default;
 }
コード例 #2
0
        static void Main(string[] args)
        {
            var config = new CoordinatorConfig();

            if (args.Length > 0)
            {
                config.CoordinatorPort = int.Parse(args[1]);
                Console.WriteLine($"CoordinatorHost: http://localhost:{config.CoordinatorPort}/");
            }

            using (var coordinator = new Coordinator(config))
            {
                Console.ReadLine();
            }
        }
コード例 #3
0
        public Option(String brokerUrls)
        {
            if (String.IsNullOrWhiteSpace(brokerUrls))
            {
                throw new ArgumentOutOfRangeException("brokerUris");
            }
            var brokerUris = brokerUrls.Split(',')
                             .Select(x => new Uri(x.StartsWith("http://") ? x : "http://" + x))
                             .ToArray();

            if (brokerUris.Length == 0)
            {
                throw new ArgumentOutOfRangeException("brokerUris");
            }
            _brokerUris       = brokerUris;
            ProducerConfig    = ProducerConfig.Default;
            ConsumerConfig    = ConsumerConfig.Default;
            CoordinatorConfig = CoordinatorConfig.Default;
        }