Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix AddArgument, Add Queue TTL config #43

Merged
merged 4 commits into from
Feb 20, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions Rebus.RabbitMq/Config/RabbitMqQueueOptionsBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;

namespace Rebus.Config
{
Expand Down Expand Up @@ -26,10 +27,20 @@ public RabbitMqQueueOptionsBuilder SetExclusive(bool exclusive)
}

/// <summary>
/// Set auto delete
/// Set auto delete, when last consumer disconnects
/// <param name="autoDelete">Whether queue should be deleted</param>
/// <param name="ttlInMs">Time to live (in milliseconds) after last subscriber disconnects</param>
/// </summary>
public RabbitMqQueueOptionsBuilder SetAutoDelete(bool autoDelete)
public RabbitMqQueueOptionsBuilder SetAutoDelete(bool autoDelete, long ttlInMs = 0)
{
if (ttlInMs < 0)
{
throw new ArgumentException("Time must be in milliseconds and greater than 0", nameof(ttlInMs));
}
else
{
Arguments.Add("x-expires", ttlInMs);
}
AutoDelete = autoDelete;
return this;
}
Expand All @@ -46,7 +57,7 @@ public RabbitMqQueueOptionsBuilder SetArguments(Dictionary<string, object> argum
/// <summary>
/// Add input queue arguments to the default settings
/// </summary>
public RabbitMqQueueOptionsBuilder AddArgument(string key, string val)
public RabbitMqQueueOptionsBuilder AddArgument(string key, object val)
{
Arguments.Add(key, val);
return this;
Expand Down