public void Run() { using (var bus = RabbitHutch.CreateBus(Connection.Local())) { ForexiteDownloadMessage downloadFileMessage = new ForexiteDownloadMessage(); CoronaVirusScrapeMessage cvMsg = new CoronaVirusScrapeMessage(); bus.Send("cv.scraper.queue.doscrape", cvMsg); EmailMessage emailMsg = new EmailMessage() { Body = "hello from easynetq", Subject = "test rmq" }; emailMsg.Recipients = new List <string> { { "*****@*****.**" }, { "*****@*****.**" }, { "*****@*****.**" }, }; bus.Send <EmailMessage>("queue.test", emailMsg); //bus.Send<DownloadFileMessage>("queue.test", downloadFileMessage); //TextMessage txtMsg = new TextMessage() { Text = "text message" }; //bus.Send<TextMessage>("queue.test", txtMsg); } }
static void Main(string[] args) { var lastDownloadDate = getLastScrape(); var nextDownloadDate = getNextDownloadDate(lastDownloadDate); // temp - file not ready yet nextDownloadDate = nextDownloadDate.AddDays(-1); string url = Path.Combine(forexiteBaseUrl, FileUtils.DateToUrlFileName(nextDownloadDate) + ".zip"); byte[] fileBytes = webClientDownloadToBytesAsync(url).Result; ForexiteDownloadMessage msg = new ForexiteDownloadMessage() { DownloadDataForDate = nextDownloadDate, FileBytes = fileBytes, Url = url }; using (var bus = RabbitHutch.CreateBus(Connection.Local())) { bus.Send("download.forexite", msg); } int i = 0; }
static void HandleDownloadFileMessage(ForexiteDownloadMessage msg) { int i = 0; var localFileName = FileUtils.DateToFxiFileName(msg.DownloadDataForDate, ".zip"); var saveFpath = Path.Combine(forexiteSaveToPath, localFileName); File.WriteAllBytes(saveFpath, msg.FileBytes); }
private void HandleDownloadFileMessage(ForexiteDownloadMessage txtMsg) { WriteLine("Download file message"); }
static void HandleDownloadFileMessage(ForexiteDownloadMessage message) { int i = 0; }