You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
abp/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/QueueDeclareConfiguration.cs

48 lines
1.2 KiB

using System.Collections.Generic;
using JetBrains.Annotations;
using RabbitMQ.Client;
namespace Volo.Abp.RabbitMQ;
public class QueueDeclareConfiguration
{
[NotNull] public string QueueName { get; }
public bool Durable { get; set; }
public bool Exclusive { get; set; }
public bool AutoDelete { get; set; }
public ushort? PrefetchCount { get; set; }
public IDictionary<string, object> Arguments { get; }
public QueueDeclareConfiguration(
[NotNull] string queueName,
bool durable = true,
bool exclusive = false,
bool autoDelete = false,
ushort? prefetchCount = null,
IDictionary<string, object>? arguments = null)
{
QueueName = queueName;
Durable = durable;
Exclusive = exclusive;
AutoDelete = autoDelete;
Arguments = arguments?? new Dictionary<string, object>();
PrefetchCount = prefetchCount;
}
public virtual QueueDeclareOk Declare(IModel channel)
{
return channel.QueueDeclare(
queue: QueueName,
durable: Durable,
exclusive: Exclusive,
autoDelete: AutoDelete,
arguments: Arguments
);
}
}