Exemplo n.º 1
0
        /// <summary>
        /// Create response queue/blob container for the specified session.
        /// </summary>
        private void CreateResponseStorage()
        {
            this.CreateStorageClient(RetryPolicyForResponseStorage);

            if (this.responseQueue == null)
            {
                BrokerTracing.TraceVerbose(
                    "[ResponseQueueManager].CreateResponseStorage: Try to create the response queue {0}",
                    this.responseStorageName);

                CloudQueue queue = this.queueClient.GetQueueReference(this.responseStorageName);

                AzureQueueManager.CreateQueueWithRetry(queue);

                if (Interlocked.CompareExchange <CloudQueue>(ref this.responseQueue, queue, null) == null)
                {
                    BrokerTracing.EtwTrace.LogQueueCreatedOrExist(this.sessionId, this.responseStorageName);
                }
            }

            if (this.responseContainer == null)
            {
                BrokerTracing.TraceVerbose(
                    "[ResponseQueueManager].CreateResponseStorage: Try to create the response container {0}",
                    this.responseStorageName);

                CloudBlobContainer container = this.blobClient.GetContainerReference(this.responseStorageName);

                AzureQueueManager.CreateContainerWithRetry(container);

                Interlocked.CompareExchange <CloudBlobContainer>(ref this.responseContainer, container, null);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Create request queue for specified Azure service.
        /// </summary>
        /// <param name="azureServiceName">azure service name</param>
        public void CreateRequestStorage(string azureServiceName)
        {
            this.requestStorage.GetOrAdd(
                azureServiceName,
                (key) =>
            {
                string requestStorageName = SoaHelper.GetRequestStorageName(this.clusterId.ToString(), key);

                BrokerTracing.TraceVerbose(
                    "[AzureQueueManager].CreateRequestStorage: Try to create the request storage {0} for Azure service {1}",
                    requestStorageName,
                    key);

                this.CreateStorageClient(RetryPolicyForRequestStorage);

                CloudQueue queue = this.queueClient.GetQueueReference(requestStorageName);

                AzureQueueManager.CreateQueueWithRetry(queue);

                CloudBlobContainer container = this.blobClient.GetContainerReference(requestStorageName);

                AzureQueueManager.CreateContainerWithRetry(container);

                if (Interlocked.CompareExchange(ref this.requestQueueExist, 1, 0) == 0)
                {
                    BrokerTracing.EtwTrace.LogQueueCreatedOrExist(this.sessionId, requestStorageName);
                }

                return(new Tuple <CloudQueue, CloudBlobContainer>(queue, container));
            });
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the ResponseQueueManager class.
        /// </summary>
        /// <param name="azureQueueManager">AzureQueueManager instance</param>
        /// <param name="sessionId">session Id</param>
        /// <param name="responseStorageName">response storage name</param>
        /// <param name="storageConnectionString">storage connection string</param>
        public ResponseQueueManager(AzureQueueManager azureQueueManager, string sessionId, string responseStorageName, string storageConnectionString)
        {
            this.azureQueueManager = azureQueueManager;

            this.sessionId = sessionId;

            this.responseStorageName = responseStorageName;

            this.storageConnectionString = storageConnectionString;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the AzureHttpsDispatcher class.
        /// </summary>
        /// <param name="azureQueueManager">AzureQueueManager instance</param>
        /// <param name="info">indicating the dispatcher info</param>
        /// <param name="binding">binding information</param>
        /// <param name="sharedData">indicating the shared data</param>
        /// <param name="observer">indicating the observer</param>
        /// <param name="queueFactory">indicating the queue factory</param>
        /// <param name="schedulerAdapterClientFactory">SchedulerAdapterClientFactory instance</param>
        /// <param name="dispatcherIdle">set when the dispatcher enters idle status</param>
        public AzureHttpsDispatcher(AzureQueueManager azureQueueManager, DispatcherInfo info, Binding binding, SharedData sharedData, BrokerObserver observer, BrokerQueueFactory queueFactory, SchedulerAdapterClientFactory schedulerAdapterClientFactory, AutoResetEvent dispatcherIdle)
            : base(info, ProxyBinding.BrokerProxyBinding, sharedData, observer, queueFactory, schedulerAdapterClientFactory, dispatcherIdle)
        {
            AzureDispatcherInfo azureDispatcherInfo = info as AzureDispatcherInfo;

            this.azureServiceName = azureDispatcherInfo.AzureServiceName;

            this.azureQueueManager = azureQueueManager;

            this.azureQueueManager.CreateRequestStorage(this.azureServiceName);

            this.responseStorageName =
                this.azureQueueManager.Start(azureDispatcherInfo.JobId, azureDispatcherInfo.RequeueCount);

            // Update backend binding's maxMessageSize settings with global maxMessageSize if its enabled (> 0)
            int maxMessageSize = sharedData.ServiceConfig.MaxMessageSize;

            if (maxMessageSize > 0)
            {
                BindingHelper.ApplyMaxMessageSize(binding, maxMessageSize);
            }

            this.backendBindingData = new BindingData(binding);
        }