123456789101112131415161718192021222324252627282930 |
- namespace metrics_collector
- {
- using System;
- using Amqp;
- class MetricsCollector
- {
- static void Main(string[] args)
- {
- string url = "amqp://localhost:61616";
- string address = "sampleQueue";
- Address a = new Address(url);
- Connection c = new Connection(a);
- Session s = new Session(c);
- ReceiverLink rl = new ReceiverLink(s, "receiver", address);
- Console.WriteLine("Receiving random metrics from " + url + "/" + address);
- while (true) {
- Message m = rl.Receive();
- rl.Accept(m);
- if (m != null) {
- Console.WriteLine("Got: " + m.Body.ToString());
- continue;
- }
- System.Threading.Thread.Sleep(1000);
- }
- }
- }
- }
|