public BrokerConsumerService( ILogger <BrokerConsumerService> logger, IOptions <RabbitMQInfo> rabbitInfo, IOptions <StockQueues> stockQueue, IConfiguration configuration, IBrokerService brokerService) { _rabbitInfo = rabbitInfo.Value; _stockQueue = stockQueue.Value; _connectionFactory = new ConnectionFactory { HostName = _rabbitInfo.HostName, UserName = _rabbitInfo.UserName, Password = _rabbitInfo.Password }; _connection = _connectionFactory.CreateConnection(); _configuration = configuration; _brokerService = brokerService; _stockApi = _configuration.GetSection("StockApi").Value; }
public ChatHubService(IServiceProvider serviceProvider, IBrokerProducerService brokerProducerService, IOptions <RabbitMQInfo> rabbitInfo, IOptions <StockQueues> stockQueues ) { _serviceProvider = serviceProvider; _brokerProducerService = brokerProducerService; _rabbitInfo = rabbitInfo.Value; _stockQueues = stockQueues.Value; _brokerProducerService.QueueCallBack += async(o, e) => { await SendMessage(BOT_USER_NAME, e.StockInfo); }; }