示例#1
0
        /// <summary>
        /// This performs the startup necessary for running an Azure WebJob.  It also initializes the Storks controller for data operations
        /// </summary>
        private static void Main()
        {
            var config = new JobHostConfiguration();

            config.Queues.MaxPollingInterval = TimeSpan.FromSeconds(12);

            // These items should be added to App.Config, alternatively replace them with strings
            var htmlStorageConnectionString = ConfigurationManager.ConnectionStrings["PdfHtmlStorage"].ConnectionString;
            var htmlStorageContainer        = ConfigurationManager.AppSettings["PdfHtmlStorageContainer"];

            // create a new communicator that utilizes Azure Storage as it's backing container
            var dataCommunicator = new AzureBlobStorageCommunicator(htmlStorageConnectionString, htmlStorageContainer);

            // create a storeController to handle data retrieval operations
            var storeController = new StoreBackedPropertyController(dataCommunicator);

            // This allows the queue handler to not have to worry about data retrieval operations
            storeController.AutoBindLoadedJson();

            if (config.IsDevelopment)
            {
                config.UseDevelopmentSettings();
            }

            var host = new JobHost(config);

            // The following code ensures that the WebJob will be running continuously
            host.RunAndBlock();
        }
示例#2
0
        /// <summary>
        /// Sets the DataCommunicator of the controller to be a <see cref="AzureBlobStorageCommunicator"/> allowing blob storage to be the backing Store
        /// </summary>
        /// <param name="controller">The controller to set the communicator for</param>
        /// <param name="connectionString">The connection string for connecting to Azure Blob storage</param>
        /// <exception cref="System.ArgumentNullException">
        /// if either <paramref name="connectionString"/>, <paramref name="controller"/> is null
        /// </exception>
        /// <returns>The <see cref="AzureBlobStorageCommunicator"/> to pass additional configuration options</returns>
        public static AzureBlobStorageCommunicator UseAzureBlobStorage(this IStoreBackedPropertyController controller, string connectionString)
        {
            Throw.IfNull(() => controller);
            var communicator = new AzureBlobStorageCommunicator(connectionString);

            controller.DataCommunicator = communicator;
            return(communicator);
        }