Program.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. namespace receive
  2. {
  3. using System;
  4. // TODO: import all the libraries, including Framing, Sasl, and Types
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. string url = "amqp://localhost:61616";
  10. string addr = "sampleTopic";
  11. bool durable = false;
  12. string cid = "";
  13. if (args.Length > 0) {
  14. durable = bool.Parse(args[0]);
  15. }
  16. if (durable && args.Length > 1) {
  17. cid = args[1];
  18. } else if (durable) {
  19. cid = Guid.NewGuid().ToString();
  20. }
  21. // TODO: create an address
  22. if (durable) {
  23. // TODO: create a connection using a client ID
  24. } else {
  25. // TODO: create an anonymous connection
  26. }
  27. Console.WriteLine("Created new " + (durable ? "" : "non-") + "durable subscriber" + (durable ? " with ID " + cid : ""));
  28. // TODO: obtain the session
  29. if (durable) {
  30. // TODO: create a durable receiver
  31. } else {
  32. // TODO: create a non-durable receiver
  33. }
  34. Console.WriteLine("Receiving random metrics from " + url + "/" + addr);
  35. while (true) {
  36. // TODO: receive a message, if there is one
  37. // TODO: only write out the message if there was one
  38. Console.WriteLine("Got: " + null);
  39. //continue;
  40. System.Threading.Thread.Sleep(1000);
  41. }
  42. }
  43. }
  44. }