static async void MainAsync(string[] args) { var m = new QueueFactory("mongodb://localhost", "redcappedtest"); var q = await m.CreateQueueAsync<string>("test2", 64*1024*1024); await PublishMessages(q, QoS.Low, 10); await PublishMessages(q, QoS.Normal, 10); await PublishMessages(q, QoS.High, 10); var counter = 0; var watch = new Stopwatch(); watch.Start(); q.Subscribe(msg => { counter++; if (counter%1000 != 0) return true; SetCursorPosition(0, CursorTop); Write("Receive rate (msg/s): {0}", Math.Truncate(decimal.Divide(1000, watch.ElapsedMilliseconds) * 1000)); watch.Restart(); return true; }); }
public void SetUp() { MongoDbUtils.DropDatabase(); _manager = new QueueFactory(MongoDbUtils.ConnectionString, MongoDbUtils.DatabaseName); _sut = _manager.CreateQueueAsync<string>("testqueue", 4096).Result; }