Exemple #1
0
        public BrokerTopology GetBrokerTopology()
        {
            var builder = new PublishEndpointBrokerTopologyBuilder();

            builder.Exchange = builder.ExchangeDeclare(ExchangeName, ExchangeType, Durable, AutoDelete, ExchangeArguments);

            var queue = builder.QueueDeclare(QueueName, Durable, AutoDelete, false, QueueArguments);

            builder.QueueBind(builder.Exchange, queue, RoutingKey, BindingArguments);

            return(builder.BuildBrokerTopology());
        }
        public BrokerTopology GetBrokerTopology()
        {
            var builder = new PublishEndpointBrokerTopologyBuilder();

            builder.Exchange = builder.ExchangeDeclare(ExchangeName, ExchangeType, Durable, AutoDelete, ExchangeArguments);

            foreach (var specification in _exchangeBindings)
            {
                specification.Apply(builder);
            }

            if (_bindToQueue)
            {
                var queue = builder.QueueDeclare(_queueName ?? ExchangeName, Durable, AutoDelete, false, QueueArguments);

                builder.QueueBind(builder.Exchange, queue, "", new Dictionary <string, object>());
            }

            return(builder.BuildBrokerTopology());
        }
        public BrokerTopology GetBrokerTopology(Uri address)
        {
            var settings = GetSendSettings(address);

            var builder = new PublishEndpointBrokerTopologyBuilder();

            builder.Exchange = builder.ExchangeDeclare(settings.ExchangeName, settings.ExchangeType, settings.Durable, settings.AutoDelete,
                                                       settings.ExchangeArguments);

            if (settings.BindToQueue)
            {
                var queue = builder.QueueDeclare(settings.QueueName, settings.Durable, settings.AutoDelete, false, settings.QueueArguments);
                builder.QueueBind(builder.Exchange, queue, "", new Dictionary <string, object>());
            }

            foreach (var specification in settings.PublishTopologySpecifications)
            {
                specification.Apply(builder);
            }

            return(builder.BuildTopologyLayout());
        }