private Exchange CreateExchange(string exchangeName) { var vhost = new Vhost { Name = vhostName }; var exchangeInfo = new ExchangeInfo(exchangeName, "direct"); var exchange = managementClient.CreateExchange(exchangeInfo, vhost); return(exchange); }
public void Should_be_able_to_create_an_exchange() { var vhost = new Vhost { Name = "/" }; var exchangeInfo = new ExchangeInfo(testExchange, "direct"); var exchange = managementClient.CreateExchange(exchangeInfo, vhost); exchange.Name.ShouldEqual(testExchange); }
protected internal override void Apply(IManagementClient managementClient) { _log.Info($"Declaring exchange '{Name}' on '{VirtualHost}'"); _log.Info($" Type = {Type}"); _log.Info($" AutoDelete = {AutoDelete}"); _log.Info($" Durable = {Durable}"); _log.Info($" Internal = {Internal}"); var virtualHost = managementClient.GetVhost(VirtualHost); var exchangeType = Type.ToString().ToLowerInvariant(); var arguments = new Arguments(); var exchangeInfo = new ExchangeInfo(Name, exchangeType, AutoDelete, Durable, Internal, arguments); if (AlternateExchangeDeclared) { _log.Info($" AlternateExchange = {AlternateExchange}"); arguments.Add("alternate-exchange", AlternateExchange); } managementClient.CreateExchange(exchangeInfo, virtualHost); _log.Info($"Finished declaring exchange '{Name}' on '{VirtualHost}'"); }