コード例 #1
0
        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);
            }
        }
コード例 #2
0
        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;
        }
コード例 #3
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);
        }
コード例 #4
0
 private void HandleDownloadFileMessage(ForexiteDownloadMessage txtMsg)
 {
     WriteLine("Download file message");
 }
コード例 #5
0
 static void HandleDownloadFileMessage(ForexiteDownloadMessage message)
 {
     int i = 0;
 }