|
@@ -0,0 +1,53 @@
|
|
|
|
+namespace receive
|
|
|
|
+{
|
|
|
|
+ using System;
|
|
|
|
+ // TODO: import all the libraries, including Framing, Sasl, and Types
|
|
|
|
+ class Program
|
|
|
|
+ {
|
|
|
|
+ static void Main(string[] args)
|
|
|
|
+ {
|
|
|
|
+ string url = "amqp://localhost:61616";
|
|
|
|
+ string addr = "sampleTopic";
|
|
|
|
+
|
|
|
|
+ bool durable = false;
|
|
|
|
+ string cid = "";
|
|
|
|
+ if (args.Length > 0) {
|
|
|
|
+ durable = bool.Parse(args[0]);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (durable && args.Length > 1) {
|
|
|
|
+ cid = args[1];
|
|
|
|
+ } else if (durable) {
|
|
|
|
+ cid = Guid.NewGuid().ToString();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // TODO: create an address
|
|
|
|
+ if (durable) {
|
|
|
|
+ // TODO: create a connection using a client ID
|
|
|
|
+ } else {
|
|
|
|
+ // TODO: create an anonymous connection
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Console.WriteLine("Created new " + (durable ? "" : "non-") + "durable subscriber" + (durable ? " with ID " + cid : ""));
|
|
|
|
+
|
|
|
|
+ // TODO: obtain the session
|
|
|
|
+
|
|
|
|
+ if (durable) {
|
|
|
|
+ // TODO: create a durable receiver
|
|
|
|
+ } else {
|
|
|
|
+ // TODO: create a non-durable receiver
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Console.WriteLine("Receiving random metrics from " + url + "/" + addr);
|
|
|
|
+ while (true) {
|
|
|
|
+ // TODO: receive a message, if there is one
|
|
|
|
+ // TODO: only write out the message if there was one
|
|
|
|
+ Console.WriteLine("Got: " + null);
|
|
|
|
+ //continue;
|
|
|
|
+
|
|
|
|
+ System.Threading.Thread.Sleep(1000);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|