Esempio n. 1
0
 public Dictionary <string, object> GetProducerConfig()
 {
     return(new Dictionary <string, object>
     {
         { "acks", (int)Acks.GetValueOrDefault(Configuration.Acks.One) },
         { "bootstrap.servers", string.Join(",", BootstrapServers) },
         { "client.id", ClientId ?? $"{Assembly.GetEntryAssembly().FullName.ToLower()}-{Environment.MachineName.ToLower()}" },
         { "compression.type", CompressionType.GetValueOrDefault(Configuration.CompressionType.None).ToString().ToLower() },
         { "linger.ms", LingerMs.GetValueOrDefault(0) },
         { "request.timeout.ms", RequestTimeoutMs.GetValueOrDefault(30000) },
         { "retries", Retries.GetValueOrDefault(10000000) },
         { "debug", DebugContexts ?? "generic" },
         { "log_level", (int)LogLevel.GetValueOrDefault(Configuration.LogLevel.LOG_INFO) }
     });
 }
Esempio n. 2
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) }
     });
 }