Created
February 23, 2021 01:16
-
-
Save xximjasonxx/1632003fbfee8ccc172081721d614707 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace StockPriceWriter | |
{ | |
public class Application | |
{ | |
private readonly IGetStockService _getStockService; | |
private readonly IPublishService _publishService; | |
public Application(IGetStockService getStockService, IPublishService publishService) | |
{ | |
_getStockService = getStockService; | |
_publishService = publishService; | |
} | |
public async Task ExecuteAsync() | |
{ | |
var stockData = await _getStockService.GetStockDataAsync(); | |
foreach (var stock in stockData) | |
{ | |
_publishService.SendMessage(new PriceChange | |
{ | |
Symbol = stock.Symbol, | |
Price = stock.StockPrice | |
}.ToString()); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment