コード例 #1
0
 public WeatherForecastController(ILogger <WeatherForecastController> logger, IConfiguration config, KafkaDependentProducer <Null, string> producer)
 {
     _logger     = logger;
     _cts        = new CancellationTokenSource();
     _producer   = producer;
     this._topic = config.GetValue <string>("Kafka:Topic");
 }
コード例 #2
0
 public HomeController(KafkaDependentProducer <Null, string> producer, IConfiguration config, ILogger <HomeController> logger)
 {
     // In a real-world application, you might be using Kafka as a system of record and may wish
     // to update application state in your request handlers. Or you may wish to write some
     // analytics data related to your handler logic. In this example, we aren't doing anything
     // interesting, so we just write frivolous messages to demonstrate how to set things up.
     this.topic    = config.GetValue <string>("Kafka:FrivolousTopic");
     this.producer = producer;
     this.logger   = logger;
 }