public TomatoLogClientKafkaTest() { var options = new EventKafkaOptions { Logger = null, LogLevel = Microsoft.Extensions.Logging.LogLevel.Information, ProjectLabel = "20272", ProjectName = "TomatoLog", SysOptions = new EventSysOptions { EventId = true, IP = true, IPList = true, MachineName = true, ProcessId = true, ProcessName = true, ThreadId = true, Timestamp = true, UserName = true }, Tags = null, Version = "1.0.1", BootstrapServers = "127.0.0.1:9092", Topic = "TomatoLog" }; client = new TomatoLogClientKafka(options); }
public TomatoLogClientKafka(EventKafkaOptions options) : base(options) { Check.NotNull(options.BootstrapServers, nameof(options.BootstrapServers)); Check.NotNull(options.Topic, nameof(options.Topic)); logClient = new LogClient(options); optionsRedis = options; Instance = this; }
public LogClient(EventKafkaOptions options) { this.options = options; var config = new ProducerConfig { BootstrapServers = options.BootstrapServers }; producer = new ProducerBuilder <Null, string>(config).Build(); }
/// <summary> /// Use Kafka with options /// </summary> /// <param name="optionAction"></param> /// <returns></returns> public TomatoLogSinkOptions UseKafka(Action <EventKafkaOptions> optionAction = null) { if (optionAction != null) { var option = KafkaOptions ?? new EventKafkaOptions(); optionAction(option); KafkaOptions = option; } FlowType = LogFlowTypes.Kafka; return(this); }