Example #1
0
 private Exchange(ExchangeName name, ExchangeType type)
 {
     Name         = name;
     Type         = type;
     Durability   = Durability.Transient;
     IsInternal   = false;
     IsAutoDelete = false;
 }
Example #2
0
        /// <summary>
        /// If messages to this exchange cannot otherwise be routed, send them to the alternate exchange named here.
        /// </summary>
        /// <param name="exchangeName">Exchange name.</param>
        /// <returns></returns>
        public Exchange WithAlternateExchange(ExchangeName exchangeName)
        {
            const string key = "alternate-exchange";

            _arguments.Remove(key);
            _arguments.Add(key, exchangeName.Value);

            return(this);
        }
Example #3
0
        /// <summary>
        /// If messages expires is setup, send the message to another exchange and routing when expired.
        /// </summary>
        /// <param name="exchangeName">Name of an exchange to which messages will be republished if they are rejected or expire.</param>
        /// <param name="routing">Optional replacement routing key to use when a message is dead-lettered. If this is not set, the message's original routing key will be used.</param>
        /// <returns></returns>
        public Queue SendExpiredMessagesTo(ExchangeName exchangeName, RoutingKey routing)
        {
            const string exchangeKey = "x-dead-letter-exchange";
            const string routingKey  = "x-dead-letter-routing-key";

            _arguments.Remove(exchangeKey);
            _arguments.Remove(routingKey);

            _arguments.Add(exchangeKey, exchangeName.Value);
            _arguments.Add(routingKey, routing.Value);

            return(this);
        }
Example #4
0
 public static Exchange Create(string name, ExchangeType type)
 {
     return(new Exchange(ExchangeName.Create(name), type));
 }