Example #1
0
        public static async Task Main(string[] args)
        {
            var config = new ProducerConfig {
                BootstrapServers = args.Length > 0 ? args[0] : "localhost:9092"
            };

            using (var producer = new ProducerBuilder <Null, string>(config).Build())
            {
                do
                {
                    while (!Console.KeyAvailable)
                    {
                        try
                        {
                            string msg = $"{{\"cliente\": \"{NAMES.GetRandom()}\",\"produto\": \"{PRODUCTS.GetRandom()}\",\"opiniao\": \"{OPINIONS.GetRandom()}\"}}";
                            var    dr  = await producer.ProduceAsync("test", new Message <Null, string> {
                                Value = msg
                            });

                            Console.WriteLine($"=> '{dr.Value}' to '{dr.TopicPartitionOffset}'");
                        }
                        catch (ProduceException <Null, string> e)
                        {
                            Console.WriteLine($"ERRO: {e.Error.Reason}");
                        }
                        Random _rnd = new Random(Environment.TickCount);
                        Thread.Sleep(_rnd.Next(250, 750));
                    }
                } while (Console.ReadKey(true).Key != ConsoleKey.Escape);
            }
        }
Example #2
0
 static DayRollConventions()
 {
     ImmutableMap.Builder <string, RollConvention> mapBuilder = ImmutableMap.builder();
     foreach (RollConvention roll in Dom.CONVENTIONS)
     {
         mapBuilder.put(roll.Name, roll);
         mapBuilder.put(roll.Name.ToUpper(Locale.ENGLISH), roll);
     }
     foreach (RollConvention roll in Dow.CONVENTIONS)
     {
         mapBuilder.put(roll.Name, roll);
         mapBuilder.put(roll.Name.ToUpper(Locale.ENGLISH), roll);
     }
     MAP = mapBuilder.build();
     for (int i = 0; i < 30; i++)
     {
         CONVENTIONS[i] = new Dom(i + 1);
     }
     for (int i = 0; i < 7; i++)
     {
         DayOfWeek dow  = DayOfWeek.of(i + 1);
         string    name = NAMES.substring(i * 6, ((i + 1) * 6) - (i * 6));
         CONVENTIONS[i] = new Dow(dow, name);
     }
 }
Example #3
0
 public NAMESHandler(ISession client, ChatCommandBase cmd) : base(client, cmd)
 {
     _namesCmd = (NAMES)cmd;
 }
 METERS(NAMES name, Markers mark)
 {
     this.name = name;
     this.mark = mark;
 }
 METERS(NAMES name, Coordinate2DDrawer.Markers mark)
 {
     this.name = name;
     this.mark = mark;
 }