Ejemplo n.º 1
0
        /// <summary>
        ///     Sets deadLetterExchange. Determines an exchange's name can remain unused before it is automatically deleted by the server.
        /// </summary>
        /// <param name="configuration">The configuration instance</param>
        /// <param name="deadLetterExchange">The deadLetterExchange to set</param>
        /// <returns>IQueueDeclareConfiguration</returns>
        public static IQueueDeclareConfiguration WithDeadLetterExchange(this IQueueDeclareConfiguration configuration, IExchange deadLetterExchange)
        {
            Preconditions.CheckNotNull(configuration, "configuration");

            return(configuration.WithArgument("x-dead-letter-exchange", deadLetterExchange.Name));
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Sets deadLetterRoutingKey. If set, will route message with the routing key specified, if not set, message will be routed with the same routing keys they were originally published with.
        /// </summary>
        /// <param name="configuration">The configuration instance</param>
        /// <param name="deadLetterRoutingKey">The deadLetterRoutingKey to set</param>
        /// <returns>IQueueDeclareConfiguration</returns>
        public static IQueueDeclareConfiguration WithDeadLetterRoutingKey(this IQueueDeclareConfiguration configuration, string deadLetterRoutingKey)
        {
            Preconditions.CheckNotNull(configuration, "configuration");

            return(configuration.WithArgument("x-dead-letter-routing-key", deadLetterRoutingKey));
        }
Ejemplo n.º 3
0
        /// <summary>
        ///     Sets expires of the queue. Determines how long a queue can remain unused before it is automatically deleted by the server.
        /// </summary>
        /// <param name="configuration">The configuration instance</param>
        /// <param name="expires">The expires to set</param>
        /// <returns>IQueueDeclareConfiguration</returns>
        public static IQueueDeclareConfiguration WithExpires(this IQueueDeclareConfiguration configuration, TimeSpan expires)
        {
            Preconditions.CheckNotNull(configuration, "configuration");

            return(configuration.WithArgument("x-expires", (int)expires.TotalMilliseconds));
        }
Ejemplo n.º 4
0
        /// <summary>
        ///     Sets messageTtl. Determines how long a message published to a queue can live before it is discarded by the server.
        /// </summary>
        /// <param name="configuration">The configuration instance</param>
        /// <param name="messageTtl">The messageTtl to set</param>
        /// <returns>IQueueDeclareConfiguration</returns>
        public static IQueueDeclareConfiguration WithMessageTtl(this IQueueDeclareConfiguration configuration, TimeSpan messageTtl)
        {
            Preconditions.CheckNotNull(configuration, "configuration");

            return(configuration.WithArgument("x-message-ttl", (int)messageTtl.TotalMilliseconds));
        }
Ejemplo n.º 5
0
        /// <summary>
        ///     Sets maxLengthBytes. The maximum size of the queue in bytes.  Messages will be dropped or dead-lettered from the front of the queue to make room for new messages once the limit is reached.
        /// </summary>
        /// <param name="configuration">The configuration instance</param>
        /// <param name="maxLengthBytes">The maxLengthBytes flag to set</param>
        /// <returns>IQueueDeclareConfiguration</returns>
        public static IQueueDeclareConfiguration WithMaxLengthBytes(this IQueueDeclareConfiguration configuration, int maxLengthBytes)
        {
            Preconditions.CheckNotNull(configuration, "configuration");

            return(configuration.WithArgument("x-max-length-bytes", maxLengthBytes));
        }
Ejemplo n.º 6
0
        /// <summary>
        ///     Sets queue as autoDelete or not. If set, the queue is deleted when all consumers have finished using it.
        /// </summary>
        /// <param name="configuration">The configuration instance</param>
        /// <param name="maxPriority">The maxPriority to set</param>
        /// <returns>IQueueDeclareConfiguration</returns>
        public static IQueueDeclareConfiguration WithMaxPriority(this IQueueDeclareConfiguration configuration, int maxPriority)
        {
            Preconditions.CheckNotNull(configuration, "configuration");

            return(configuration.WithArgument("x-max-priority", maxPriority));
        }
Ejemplo n.º 7
0
        /// <summary>
        ///     Enables single active consumer
        /// </summary>
        /// <param name="configuration">The configuration instance</param>
        /// <returns>IQueueDeclareConfiguration</returns>
        public static IQueueDeclareConfiguration WithSingleActiveConsumer(this IQueueDeclareConfiguration configuration)
        {
            Preconditions.CheckNotNull(configuration, "configuration");

            return(configuration.WithArgument("x-single-active-consumer", true));
        }
Ejemplo n.º 8
0
        /// <summary>
        ///     Sets queueType. Valid types are classic and quorum.
        /// </summary>
        /// <param name="configuration">The configuration instance</param>
        /// <param name="queueType">The queueType to set</param>
        /// <returns>IQueueDeclareConfiguration</returns>
        public static IQueueDeclareConfiguration WithQueueType(this IQueueDeclareConfiguration configuration, string queueType = QueueType.Classic)
        {
            Preconditions.CheckNotNull(configuration, "configuration");

            return(configuration.WithArgument("x-queue-type", queueType));
        }
Ejemplo n.º 9
0
        /// <summary>
        ///     Sets queueMode. Valid modes are default and lazy.
        /// </summary>
        /// <param name="configuration">The configuration instance</param>
        /// <param name="queueMode">The queueMode to set</param>
        /// <returns>IQueueDeclareConfiguration</returns>
        public static IQueueDeclareConfiguration WithQueueMode(this IQueueDeclareConfiguration configuration, string queueMode = QueueMode.Default)
        {
            Preconditions.CheckNotNull(configuration, "configuration");

            return(configuration.WithArgument("x-queue-mode", queueMode));
        }