Program.cs 704 B

123456789101112131415161718192021222324
  1. namespace send
  2. {
  3. using System;
  4. // TODO: import library
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. string url = "amqp://localhost:61616";
  10. string addr = "sampleTopic";
  11. // TODO: create and initialise messaging objects
  12. Console.WriteLine("Sending random metrics to " + url + "/" + addr);
  13. var rand = new Random();
  14. while (true) {
  15. // TODO: send a message containing a random number to the topic
  16. Console.WriteLine("Sent: " + rand.Next(10000).ToString());
  17. System.Threading.Thread.Sleep(1000);
  18. }
  19. }
  20. }
  21. }