diff --git a/src/HangFire.Azure.ServiceBusQueue/ServiceBusManager.cs b/src/HangFire.Azure.ServiceBusQueue/ServiceBusManager.cs
index 2fe2138..bc67f7b 100644
--- a/src/HangFire.Azure.ServiceBusQueue/ServiceBusManager.cs
+++ b/src/HangFire.Azure.ServiceBusQueue/ServiceBusManager.cs
@@ -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)
{
diff --git a/src/HangFire.Azure.ServiceBusQueue/ServiceBusQueueOptions.cs b/src/HangFire.Azure.ServiceBusQueue/ServiceBusQueueOptions.cs
index 7c6ca54..7902ed6 100644
--- a/src/HangFire.Azure.ServiceBusQueue/ServiceBusQueueOptions.cs
+++ b/src/HangFire.Azure.ServiceBusQueue/ServiceBusQueueOptions.cs
@@ -40,6 +40,17 @@ public ServiceBusQueueOptions()
public string[] Queues { get; set; }
+ ///
+ /// Gets or sets a value which specifies the
+ /// setting on creating a service bus queue.
+ ///
+ ///
+ /// This can provide resilience against retried messages due to transient errors within Hangfire, but will not help
+ /// with application-level issues.
+ /// This setting can only be applied to premium tier namespace, leave null if using a standard tier namespace.
+ ///
+ public bool? RequiresDuplicateDetection { get; set; }
+
///
/// 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).