public TestQueue(TestAmqpBroker broker) { this.broker = broker; this.messages = new LinkedList <BrokerMessage>(); this.waiters = new Queue <Consumer>(); this.publishers = new Dictionary <int, Publisher>(); this.consumers = new Dictionary <int, Consumer>(); this.syncRoot = this.waiters; }
static void Run(string[] args) { List <string> endpoints = new List <string>(); string creds = null; string sslValue = null; string[] queues = null; bool parseEndpoint = true; for (int i = 0; i < args.Length; i++) { if (args[i][0] != '/' && parseEndpoint) { endpoints.Add(args[i]); } else { parseEndpoint = false; if (args[i].StartsWith("/creds:", StringComparison.OrdinalIgnoreCase)) { creds = args[i].Substring(7); } else if (args[i].StartsWith("/queues:", StringComparison.OrdinalIgnoreCase)) { queues = args[i].Substring(8).Split(';'); } else if (args[i].StartsWith("/cert:", StringComparison.OrdinalIgnoreCase)) { sslValue = args[i].Substring(6); } else { Console.WriteLine("Unknown argument: {0}", args[i]); Usage(); return; } } } var broker = new TestAmqpBroker(endpoints, creds, sslValue, queues); broker.Start(); Console.WriteLine("Broker started. Press the enter key to exit..."); Console.ReadLine(); broker.Stop(); Console.WriteLine("Broker stopped"); }
static void Run(string[] args) { List<string> endpoints = new List<string>(); string creds = null; string sslValue = null; string[] queues = null; bool parseEndpoint = true; for (int i = 0; i < args.Length; i++) { if (args[i][0] != '/' && parseEndpoint) { endpoints.Add(args[i]); } else { parseEndpoint = false; if (args[i].StartsWith("/creds:", StringComparison.OrdinalIgnoreCase)) { creds = args[i].Substring(7); } else if (args[i].StartsWith("/queues:", StringComparison.OrdinalIgnoreCase)) { queues = args[i].Substring(8).Split(';'); } else if (args[i].StartsWith("/cert:", StringComparison.OrdinalIgnoreCase)) { sslValue = args[i].Substring(6); } else { Console.WriteLine("Unknown argument: {0}", args[i]); Usage(); return; } } } var broker = new TestAmqpBroker(endpoints, creds, sslValue, queues); broker.Start(); Console.WriteLine("Broker started. Press the enter key to exit..."); Console.ReadLine(); broker.Stop(); Console.WriteLine("Broker stopped"); }
public TestQueue(TestAmqpBroker broker) { this.broker = broker; this.messages = new LinkedList<BrokerMessage>(); this.waiters = new Queue<Consumer>(); this.publishers = new Dictionary<int, Publisher>(); this.consumers = new Dictionary<int, Consumer>(); this.syncRoot = this.waiters; }
static void Run(string[] args) { List <string> endpoints = new List <string>(); string creds = null; string trace = null; string sslValue = null; string[] queues = null; bool parseEndpoint = true; for (int i = 0; i < args.Length; i++) { if (args[i][0] != '/' && parseEndpoint) { endpoints.Add(args[i]); } else { parseEndpoint = false; if (args[i].StartsWith("/creds:", StringComparison.OrdinalIgnoreCase)) { creds = args[i].Substring(7); } else if (args[i].StartsWith("/trace:", StringComparison.OrdinalIgnoreCase)) { trace = args[i].Substring(7); } else if (args[i].StartsWith("/queues:", StringComparison.OrdinalIgnoreCase)) { queues = args[i].Substring(8).Split(';'); } else if (args[i].StartsWith("/cert:", StringComparison.OrdinalIgnoreCase)) { sslValue = args[i].Substring(6); } else { Console.WriteLine("Unknown argument: {0}", args[i]); Usage(); return; } } } if (trace != null) { TraceLevel level = 0; switch (trace) { case "info": level = TraceLevel.Information; break; case "warn": level = TraceLevel.Warning; break; case "error": level = TraceLevel.Error; break; case "verbose": level = TraceLevel.Verbose; break; case "frame": level = TraceLevel.Frame; break; default: Usage(); return; } Trace.TraceLevel = level; Trace.TraceListener = (f, a) => Console.WriteLine(DateTime.Now.ToString("[hh:ss.fff]") + " " + string.Format(f, a)); } var broker = new TestAmqpBroker(endpoints, creds, sslValue, queues); broker.Start(); Console.WriteLine("Broker started. Press the enter key to exit..."); Console.ReadLine(); broker.Stop(); Console.WriteLine("Broker stopped"); }