コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the CloudExecutionQueue class.
        /// </summary>
        /// <remarks>
        /// This is the constructor for clients (does extra stuff).
        /// </remarks>
        /// <param name="reportQueueName">Name of the report queue this client is using.</param>
        public CloudExecutionQueue(string reportQueueName)
            : this()
        {
            if (string.IsNullOrEmpty(reportQueueName))
            {
                // Use default shared report queue if none is specified.
                reportQueueName = CloudExecutionQueue.ReportQueueName;
            }
            else
            {
                // Schedule auto-deletion of our private report queue.
                // We do this by setting the initial invisibility of a delete queue request.
                // This will auto-clean up our private report queue if we exit unexpectedly.
                CloudExecutionRequest deleteQueueRequest = new CloudExecutionRequest(
                    reportQueueName,
                    reportQueueName,
                    CloudExecutionRequest.Operation.DeleteQueue,
                    null,
                    null,
                    null,
                    null
                    );
                CloudQueueMessage deleteQueueMessage = new CloudQueueMessage(deleteQueueRequest.ToXml());
                this.requestQueue.AddMessage(deleteQueueMessage, new TimeSpan(12, 0, 0), new TimeSpan(4, 0, 0));
            }

            this.clientReportQueue = this.queueClient.GetQueueReference(reportQueueName);
            this.clientReportQueue.CreateIfNotExists();

            this.reportWaiters     = new Dictionary <string, CloudExecutionWaiter>();
            this.reportWaitersLock = new Mutex();
            this.haveReportWaiters = new ManualResetEvent(false);

            this.monitoringThread = new Thread(new ThreadStart(this.MonitorReportQueue));
            this.monitoringThread.IsBackground = true;
            this.monitoringThread.Name         = "Report Queue Monitor";
            this.monitoringThread.Start();
        }
コード例 #2
0
 /// <summary>
 /// Submits a request for cloud execution.
 /// </summary>
 /// <param name="request">
 /// The CloudExecutionRequest detailing this request.
 /// </param>
 public void SubmitRequest(CloudExecutionRequest request)
 {
     CloudQueueMessage message = new CloudQueueMessage(request.ToXml());
     this.requestQueue.AddMessage(message, this.queueEntryTtl);
 }
コード例 #3
0
        /// <summary>
        /// Initializes a new instance of the CloudExecutionQueue class.
        /// </summary>
        /// <remarks>
        /// This is the constructor for clients (does extra stuff).
        /// </remarks>
        /// <param name="reportQueueName">Name of the report queue this client is using.</param>
        public CloudExecutionQueue(string reportQueueName)
            : this()
        {
            if (string.IsNullOrEmpty(reportQueueName))
            {
                // Use default shared report queue if none is specified.
                reportQueueName = CloudExecutionQueue.ReportQueueName;
            }
            else
            {
                // Schedule auto-deletion of our private report queue.
                // We do this by setting the initial invisibility of a delete queue request.
                // This will auto-clean up our private report queue if we exit unexpectedly.
                CloudExecutionRequest deleteQueueRequest = new CloudExecutionRequest(
                    reportQueueName,
                    reportQueueName,
                    CloudExecutionRequest.Operation.DeleteQueue,
                    null,
                    null,
                    null,
                    null
                    );
                CloudQueueMessage deleteQueueMessage = new CloudQueueMessage(deleteQueueRequest.ToXml());
                this.requestQueue.AddMessage(deleteQueueMessage, new TimeSpan(12, 0, 0), new TimeSpan(4, 0, 0));
            }

            this.clientReportQueue = this.queueClient.GetQueueReference(reportQueueName);
            this.clientReportQueue.CreateIfNotExists();

                this.reportWaiters = new Dictionary<string, CloudExecutionWaiter>();
                this.reportWaitersLock = new Mutex();
            this.haveReportWaiters = new ManualResetEvent(false);

                this.monitoringThread = new Thread(new ThreadStart(this.MonitorReportQueue));
                this.monitoringThread.IsBackground = true;
            this.monitoringThread.Name = "Report Queue Monitor";
            this.monitoringThread.Start();
            }
コード例 #4
0
        /// <summary>
        /// Submits a request for cloud execution.
        /// </summary>
        /// <param name="request">
        /// The CloudExecutionRequest detailing this request.
        /// </param>
        public void SubmitRequest(CloudExecutionRequest request)
        {
            CloudQueueMessage message = new CloudQueueMessage(request.ToXml());

            this.requestQueue.AddMessage(message, this.queueEntryTtl);
        }