static async Task Main(string[] args) { var options = new RabbitOptions { Connection = new RabbitConnection { HostName = "localhost", Username = "******", Password = "******", VirtualHost = "/", }, Bindings = GetBindings() }; var manager = new RabbitConnectionManager(new RabbitConnectionFactory(), options); var channel = manager.GetChannel(); var cts = new CancellationTokenSource(); channel.Publish("SampleEvents", "SampleEvents", new SampleEvent { Id = -101, Greeting = "Mayfair" }); channel.Consume <SampleEvent>(options.Bindings[0].Queue.Queue, true, async se => { await Task.CompletedTask; cts.Cancel(); }); await Task.Delay(-1, cts.Token); }
public void TearDown() { #if INTEGRATION // Removes all the queues used for the tests var connection = new RabbitConnectionManager(new Uri(connectionString)); using (var channel = connection.GetChannel()) { foreach (var guid in usedGuids) { channel.QueueDelete(guid.ToString()); channel.QueueDelete(guid.ToString() + "_Delay"); channel.QueueDelete(guid.ToString() + "_Error"); } } #endif }