public IAzureQueueClient Create(string queueName, bool checkIfExists = false) { var client = QueueClient.CreateFromConnectionString(connectionString, queueName); var azureQueueClient = new AzureQueueClient(client); if (!checkIfExists) { return azureQueueClient; } // Configure Queue Settings var namespaceManager = NamespaceManager.CreateFromConnectionString(connectionString); // Create queue if not exists: try { TryCreateQueueIfNotExists(namespaceManager, queueName); } catch (MessagingException ex) { //If queue was deleted recently Service Bus may throw Microsoft.ServiceBus.Messaging.MessagingException. Then we have to retry to create queue. if (ex.IsTransient) //Check this property to determine if the operation should be retried. { TryCreateQueueIfNotExists(namespaceManager, queueName); } else { throw; } } return azureQueueClient; }
public IAzureQueueClient Create(string queueName, bool checkIfExists = false) { var client = QueueClient.CreateFromConnectionString(connectionString, queueName); var azureQueueClient = new AzureQueueClient(client); if (!checkIfExists) { return(azureQueueClient); } // Configure Queue Settings var namespaceManager = NamespaceManager.CreateFromConnectionString(connectionString); // Create queue if not exists: try { TryCreateQueueIfNotExists(namespaceManager, queueName); } catch (MessagingException ex) { //If queue was deleted recently Service Bus may throw Microsoft.ServiceBus.Messaging.MessagingException. Then we have to retry to create queue. if (ex.IsTransient) //Check this property to determine if the operation should be retried. { TryCreateQueueIfNotExists(namespaceManager, queueName); } else { throw; } } return(azureQueueClient); }