예제 #1
0
        /// <summary>
        /// Returns the configuration properties for a specified queue.
        /// </summary>
        /// <param name="queueName">The queue name to search.</param>
        /// <returns>The configured properties or a default instance.</returns>
        public QueuePropertiesSettings GetQueueProperties(string queueName)
        {
            Check.NotNull(queueName, nameof(queueName));

            QueuePropertiesSettings props = QueueProperties.FirstOrDefault(qp => qp.QueueName == queueName);

            return(props ?? new QueuePropertiesSettings {
                QueueName = queueName
            });
        }
예제 #2
0
        /// <summary>
        /// Applies all externally defined queue properties to a consumer's queue.
        /// </summary>
        /// <param name="consumer">The consumer configuration.</param>
        public void ApplyQueueSettings(MessageConsumer consumer)
        {
            Check.NotNull(consumer, nameof(consumer));

            IEnumerable <QueuePropertiesSettings> properties = GetBrokerQueueProperties(consumer.BrokerName);
            QueuePropertiesSettings queueProps = properties.FirstOrDefault(qp => qp.QueueName == consumer.QueueName);

            if (queueProps != null)
            {
                consumer.RouteKeys = queueProps.RouteKeys.ToArray();
            }
        }