public StockConsumer(IOptions <AppSettings> options, IStockCsvParser stockCsvParser) { _stockCsvParser = stockCsvParser; try { var factory = new ConnectionFactory() { // This is my side of the configuration, you can use it yourself. HostName = options.Value.RabbitMqHost //UserName = options.Value.RabbitUserName, //Password = options.Value.RabbitPassword, //Port = options.Value.RabbitPort, }; this._connection = factory.CreateConnection(); this._channel = _connection.CreateModel(); } catch (Exception ex) { Console.WriteLine($"RabbitListener init error,ex:{ex.Message}"); } }
public HomeController(IStockCsvParser stockCsvParser) { _stockCsvParser = stockCsvParser; }