public async Task <QueueDescription> CreateQueue(QueueDescription queueDescription) { var queueExists = await _namespaceManager.QueueExistsAsync(queueDescription.Path).ConfigureAwait(false); if (queueExists) { queueDescription = await _namespaceManager.GetQueueAsync(queueDescription.Path).ConfigureAwait(false); } else { try { if (_log.IsDebugEnabled) { _log.DebugFormat("Creating queue {0}", queueDescription.Path); } queueDescription = await _namespaceManager.CreateQueueAsync(queueDescription).ConfigureAwait(false); } catch (MessagingEntityAlreadyExistsException) { queueDescription = await _namespaceManager.GetQueueAsync(queueDescription.Path).ConfigureAwait(false); } } if (_log.IsDebugEnabled) { _log.DebugFormat("Queue: {0} ({1})", queueDescription.Path, string.Join(", ", new[] { queueDescription.RequiresDuplicateDetection ? "dupe detect" : "", queueDescription.EnableDeadLetteringOnMessageExpiration ? "dead letter" : "", queueDescription.RequiresSession ? "session" : "" }.Where(x => !string.IsNullOrWhiteSpace(x)))); } return(queueDescription); }
public async Task <QueueDescription> CreateQueue(QueueDescription queueDescription) { var queueExists = await _namespaceManager.QueueExistsAsync(queueDescription.Path).ConfigureAwait(false); if (queueExists) { queueDescription = await _namespaceManager.GetQueueAsync(queueDescription.Path).ConfigureAwait(false); } else { try { LogContext.Debug?.Log("Creating queue {Queue}", queueDescription.Path); queueDescription = await _namespaceManager.CreateQueueAsync(queueDescription).ConfigureAwait(false); } catch (MessagingEntityAlreadyExistsException) { queueDescription = await _namespaceManager.GetQueueAsync(queueDescription.Path).ConfigureAwait(false); } } LogContext.Debug?.Log("Queue: {Queue} ({Attributes})", queueDescription.Path, string.Join(", ", new[] { queueDescription.RequiresDuplicateDetection ? "dupe detect" : "", queueDescription.EnableDeadLetteringOnMessageExpiration ? "dead letter" : "", queueDescription.RequiresSession ? "session" : "", queueDescription.AutoDeleteOnIdle != Defaults.AutoDeleteOnIdle ? $"auto-delete: {queueDescription.AutoDeleteOnIdle.ToFriendlyString()}" : "" }.Where(x => !string.IsNullOrWhiteSpace(x)))); return(queueDescription); }