Skip to content

Commit

Permalink
Added configurable setting for duplicate detection, as it is a premiu…
Browse files Browse the repository at this point in the history
…m tier option
  • Loading branch information
TCBroad authored and barclayadam committed Nov 7, 2018
1 parent 29264fb commit d04efbc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/HangFire.Azure.ServiceBusQueue/ServiceBusManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,11 @@ private static void CreateQueueIfNotExists(string prefixedQueue, NamespaceManage

Logger.InfoFormat("Creating new queue {0}", prefixedQueue);

var description = new QueueDescription(prefixedQueue)
var description = new QueueDescription(prefixedQueue);
if (options.RequiresDuplicateDetection != null)
{
RequiresDuplicateDetection = true
};
description.RequiresDuplicateDetection = options.RequiresDuplicateDetection.Value;
}

if (options.Configure != null)
{
Expand Down
11 changes: 11 additions & 0 deletions src/HangFire.Azure.ServiceBusQueue/ServiceBusQueueOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ public ServiceBusQueueOptions()

public string[] Queues { get; set; }

/// <summary>
/// Gets or sets a value which specifies the <see cref="Microsoft.ServiceBus.Messaging.QueueDescription.RequiresDuplicateDetection"/>
/// setting on creating a service bus queue.
/// </summary>
/// <remarks>
/// <para>This can provide resilience against retried messages due to transient errors within Hangfire, but will not help
/// with application-level issues.</para>
/// <para>This setting can only be applied to premium tier namespace, leave null if using a standard tier namespace.</para>
/// </remarks>
public bool? RequiresDuplicateDetection { get; set; }

/// <summary>
/// Gets or sets a timeout that is used between loop runs of receiving messages from Azure Service Bus. This is the timeout
/// used when waiting on the last queue before looping around again (does not apply when only a single-queue exists).
Expand Down

0 comments on commit d04efbc

Please sign in to comment.