/// <summary>
        /// Get queue from queue identifier
        /// </summary>
        /// <param name="queueIdentifier">Queue identifier</param>
        /// <returns>Messaging queue</returns>
        public async Task <Queue> GetQueue(QueueIdentifier queueIdentifier)
        {
            QueueDescriptor queueDescriptor            = QueueDescriptorProvider.Queues[queueIdentifier];
            string          serviceBusConnectionString = await this.connectionStringProvider.GetServiceBusConnectionString(queueDescriptor.ServiceBusInstanceType);

            string queueName           = queueDescriptor.QueueName;
            string uniqueQueueIdentity = string.Join(":", serviceBusConnectionString, queueName);

            // cachedQueueObjects is a thread-safe dictionary (ConcurrentDictionary). If uniqueQueueIdentity is not present
            // in cachedStoreObjects, try adding it. Since GetQueue can be called concurrently by
            // different threads, it is possible for two (or more) threads to attempt inserting uniqueQueueIdentity
            // concurrently in the cachedQueueObjects. That's ok, because the call to TryAdd is guaranteed to be thread-safe.
            // One of the threads will not be able to insert (i.e., TryAdd will return false), but the code will happily execute
            // and fall through to the return statement.
            // This code makes no use of locking on the common path (i.e., reads of cachedStoreObjects).
            if (!cachedQueueObjects.ContainsKey(uniqueQueueIdentity))
            {
                ServiceBusQueue serviceBusQueue = await ServiceBusQueue.Create(serviceBusConnectionString, queueName, this.batchIntervalMs);

                Queue queue = new Queue(serviceBusQueue);
                cachedQueueObjects.TryAdd(uniqueQueueIdentity, queue);
            }

            return(cachedQueueObjects[uniqueQueueIdentity]);
        }
        /// <summary>
        /// Initialize queue descriptors
        /// </summary>
        private static void Initalize()
        {
            QueueDescriptor fanoutActivities = new QueueDescriptor()
            {
                QueueName = QueueIdentifier.FanoutActivities.ToString(),
                ServiceBusInstanceType = ServiceBusInstanceType.Default
            };
            QueueDescriptor fanoutTopics = new QueueDescriptor()
            {
                QueueName = QueueIdentifier.FanoutTopics.ToString(),
                ServiceBusInstanceType = ServiceBusInstanceType.Default
            };
            QueueDescriptor followingImports = new QueueDescriptor()
            {
                QueueName = QueueIdentifier.FollowingImports.ToString(),
                ServiceBusInstanceType = ServiceBusInstanceType.Default
            };
            QueueDescriptor likes = new QueueDescriptor()
            {
                QueueName = QueueIdentifier.Likes.ToString(),
                ServiceBusInstanceType = ServiceBusInstanceType.Default
            };
            QueueDescriptor moderation = new QueueDescriptor()
            {
                QueueName = QueueIdentifier.Moderation.ToString(),
                ServiceBusInstanceType = ServiceBusInstanceType.Default
            };
            QueueDescriptor relationships = new QueueDescriptor()
            {
                QueueName = QueueIdentifier.Relationships.ToString(),
                ServiceBusInstanceType = ServiceBusInstanceType.Default
            };
            QueueDescriptor reports = new QueueDescriptor()
            {
                QueueName = QueueIdentifier.Reports.ToString(),
                ServiceBusInstanceType = ServiceBusInstanceType.Default
            };
            QueueDescriptor resizeImages = new QueueDescriptor()
            {
                QueueName = QueueIdentifier.ResizeImages.ToString(),
                ServiceBusInstanceType = ServiceBusInstanceType.Default
            };
            QueueDescriptor search = new QueueDescriptor()
            {
                QueueName = QueueIdentifier.Search.ToString(),
                ServiceBusInstanceType = ServiceBusInstanceType.Default
            };

            Add(QueueIdentifier.FanoutActivities, fanoutActivities);
            Add(QueueIdentifier.FanoutTopics, fanoutTopics);
            Add(QueueIdentifier.FollowingImports, followingImports);
            Add(QueueIdentifier.Likes, likes);
            Add(QueueIdentifier.Moderation, moderation);
            Add(QueueIdentifier.Relationships, relationships);
            Add(QueueIdentifier.Reports, reports);
            Add(QueueIdentifier.ResizeImages, resizeImages);
            Add(QueueIdentifier.Search, search);
        }
 /// <summary>
 /// Add queue descriptor for queue identifier
 /// </summary>
 /// <param name="queueIdentifier">Queue identifier</param>
 /// <param name="queueDescriptor">Queue descriptor</param>
 private static void Add(QueueIdentifier queueIdentifier, QueueDescriptor queueDescriptor)
 {
     queues.Add(queueIdentifier, queueDescriptor);
 }