瀏覽代碼

Compatible with queues that have been created. #772

master
Savorboard 3 年之前
父節點
當前提交
b238cbb020
共有 2 個檔案被更改,包括 8 行新增3 行删除
  1. +2
    -2
      src/DotNetCore.CAP.RabbitMQ/CAP.RabbiMQOptions.cs
  2. +6
    -1
      src/DotNetCore.CAP.RabbitMQ/RabbitMQConsumerClient.cs

+ 2
- 2
src/DotNetCore.CAP.RabbitMQ/CAP.RabbiMQOptions.cs 查看文件

@@ -82,9 +82,9 @@ namespace DotNetCore.CAP
public class QueueArgumentsOptions
{
/// <summary>
/// Gets or sets queue mode by supplying the 'x-queue-mode' declaration argument with a string specifying the desired mode. Default 'default'
/// Gets or sets queue mode by supplying the 'x-queue-mode' declaration argument with a string specifying the desired mode.
/// </summary>
public string QueueMode { get; set; } = "default";
public string QueueMode { get; set; }

/// <summary>
/// Gets or sets queue message automatic deletion time (in milliseconds) "x-message-ttl", Default 864000000 ms (10 days).


+ 6
- 1
src/DotNetCore.CAP.RabbitMQ/RabbitMQConsumerClient.cs 查看文件

@@ -116,9 +116,14 @@ namespace DotNetCore.CAP.RabbitMQ

var arguments = new Dictionary<string, object>
{
{"x-queue-mode", _rabbitMQOptions.QueueArguments.QueueMode},
{"x-message-ttl", _rabbitMQOptions.QueueArguments.MessageTTL}
};

if (!string.IsNullOrEmpty(_rabbitMQOptions.QueueArguments.QueueMode))
{
arguments.Add("x-queue-mode", _rabbitMQOptions.QueueArguments.QueueMode);
}

_channel.QueueDeclare(_queueName, durable: true, exclusive: false, autoDelete: false, arguments: arguments);
}
}


Loading…
取消
儲存