Example #1
0
        public IEnumerable <KeyValuePair <string, object> > GetConfig()
        {
            var configs = new List <KeyValuePair <string, object> >();

            configs.Add(new KeyValuePair <string, object>("bootstrap.servers", Servers));
            configs.Add(new KeyValuePair <string, object>("queue.buffering.max.ms", MaxQueueBuffering.ToString()));
            configs.Add(new KeyValuePair <string, object>("socket.blocking.max.ms", MaxSocketBlocking.ToString()));
            configs.Add(new KeyValuePair <string, object>("enable.auto.commit", EnableAutoCommit.ToString()));
            configs.Add(new KeyValuePair <string, object>("log.connection.close", LogConnectionClose.ToString()));
            return(configs);
        }
Example #2
0
        public IEnumerable <KeyValuePair <string, object> > GetConsumerConfig()
        {
            var configs = new List <KeyValuePair <string, object> >();

            configs.Add(new KeyValuePair <string, object>("bootstrap.servers", Servers));
            configs.Add(new KeyValuePair <string, object>("queue.buffering.max.ms", MaxQueueBuffering.ToString()));
            configs.Add(new KeyValuePair <string, object>("socket.blocking.max.ms", MaxSocketBlocking.ToString()));
            configs.Add(new KeyValuePair <string, object>("enable.auto.commit", EnableAutoCommit.ToString()));
            configs.Add(new KeyValuePair <string, object>("log.connection.close", LogConnectionClose.ToString()));
            configs.Add(new KeyValuePair <string, object>("auto.commit.interval.ms", CommitInterval));
            configs.Add(new KeyValuePair <string, object>("auto.offset.reset", OffsetReset.ToString().ToLower()));
            configs.Add(new KeyValuePair <string, object>("session.timeout.ms", SessionTimeout));
            configs.Add(new KeyValuePair <string, object>("group.id", GroupID));
            return(configs);
        }
Example #3
0
 public Dictionary <string, object> GetConsumerConfig()
 {
     return(new Dictionary <string, object>
     {
         { "auto.commit.interval.ms", AutoCommitInterval.GetValueOrDefault(5000) },
         { "auto.offset.reset", AutoOffsetReset.GetValueOrDefault(Configuration.AutoOffsetReset.Earliest).ToString().ToLower() },
         { "bootstrap.servers", string.Join(",", BootstrapServers) },
         { "client.id", ClientId ?? $"{Assembly.GetEntryAssembly().FullName.ToLower()}-{Environment.MachineName.ToLower()}" },
         { "enable.auto.commit", EnableAutoCommit.GetValueOrDefault(false) },
         { "group.id", GroupId ?? $"{Assembly.GetEntryAssembly().GetName().Name.ToLower()}" },
         { "heartbeat.interval.ms", HeartbeatMs.GetValueOrDefault(3000) },
         { "request.timeout.ms", RequestTimeoutMs.GetValueOrDefault(30000) },
         { "session.timeout.ms", SessionTimeoutMs.GetValueOrDefault(10000) },
         { "debug", DebugContexts ?? "generic" },
         { "log_level", (int)LogLevel.GetValueOrDefault(Configuration.LogLevel.LOG_INFO) }
     });
 }