예제 #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
        private IStoreBackedPropertyController GetDefaultController(Action <StoreBackedPropertyController> customSettings = null)
        {
            var communicator = new InMemoryDataCommunicator();
            var controller   = new StoreBackedPropertyController(communicator);

            customSettings?.Invoke(controller);
            return(controller);
        }