コード例 #1
0
ファイル: Program.cs プロジェクト: CrewNerd/BoatTracker
        /// <summary>
        /// Set up for logging and call our web job functions as appropriate.
        /// </summary>
        public static void Main()
        {
            var env = EnvironmentDefinition.Instance;
            var timestamp = DateTime.UtcNow.ToString("yyyy-MM-dd_HH:MM");

            var logName = $"{env.Name}_report_{timestamp}";

            var host = new JobHost();
            host.Call(
                typeof(DailyReport).GetMethod("SendDailyReport"),
                new
                {
                    logName = logName,
                    log = $"container/{logName}"
                });

            // We refresh the bot caches every two hours for now. The bots will automatically
            // refresh on their own every 8 hours if the webjob fails to run for some reason.
            // It's better if we do it here so that user's don't see the latency.

            if (DateTime.UtcNow.Hour % 2 == 0)
            {
                logName = $"{env.Name}_refresh_{timestamp}";
                host.Call(
                    typeof(RefreshCaches).GetMethod("RefreshBotCaches"),
                    new
                    {
                        logName = logName,
                        log = $"container/{logName}"
                    });
            }
        }
コード例 #2
0
        public static void Main(string[] args)
        {
            JobHostConfiguration config = new JobHostConfiguration();

            config.Tracing.ConsoleLevel = TraceLevel.Verbose;

            // Set to a short polling interval to facilitate local
            // debugging. You wouldn't want to run prod this way.
            config.Queues.MaxPollingInterval = TimeSpan.FromSeconds(2);

            FilesConfiguration filesConfig = new FilesConfiguration();
            if (string.IsNullOrEmpty(filesConfig.RootPath))
            {
                // when running locally, set this to a valid directory
                filesConfig.RootPath = @"c:\temp\files";
            }
            EnsureSampleDirectoriesExist(filesConfig.RootPath);

            config.UseFiles(filesConfig);
            config.UseTimers();
            config.UseSample();
            config.UseCore();
            var sendGridConfiguration = new SendGridConfiguration()
            {
                ToAddress = "*****@*****.**",
                FromAddress = new MailAddress("*****@*****.**", "WebJobs Extensions Samples")
            };
            config.UseSendGrid(sendGridConfiguration);

            ConfigureTraceMonitor(config, sendGridConfiguration);

            WebHooksConfiguration webHooksConfig = new WebHooksConfiguration();
            webHooksConfig.UseReceiver<GitHubWebHookReceiver>();
            config.UseWebHooks(webHooksConfig);

            JobHost host = new JobHost(config);

            host.Call(typeof(MiscellaneousSamples).GetMethod("ExecutionContext"));
            host.Call(typeof(FileSamples).GetMethod("ReadWrite"));
            host.Call(typeof(SampleSamples).GetMethod("Sample_BindToStream"));
            host.Call(typeof(SampleSamples).GetMethod("Sample_BindToString"));
            host.Call(typeof(TableSamples).GetMethod("CustomBinding"));

            // When running in Azure Web Apps, a JobHost will gracefully shut itself
            // down, ensuring that all listeners are stopped, etc. For this sample,
            // we want to ensure that same behavior when the console app window is
            // closed. This ensures that Singleton locks that are taken are released
            // immediately, etc.
            ShutdownHandler.Register(() => { host.Stop(); });

            host.RunAndBlock();
        }
コード例 #3
0
 static void Main(string[] args)
 {
     var host = new JobHost();
     Console.WriteLine("EventHubReader has been started at " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:tt"));
     host.Call(typeof(Functions).GetMethod("ReadEventHub"));
     //host.RunAndBlock();
 }
コード例 #4
0
ファイル: Program.cs プロジェクト: aaronhoffman/azure-101
 // Please set the following connection strings in app.config for this WebJob to run:
 // AzureWebJobsDashboard and AzureWebJobsStorage
 static void Main()
 {
     var host = new JobHost();
     // The following code will invoke a function called ManualTrigger and
     // pass in data (value in this case) to the function
     host.Call(typeof(Functions).GetMethod("ManualTrigger"), new { value = 20 });
 }
コード例 #5
0
ファイル: Program.cs プロジェクト: sadiqna/TicketDesk
        // Please set the following connection strings in app.config for this WebJob to run:
        // AzureWebJobsDashboard and AzureWebJobsStorage
        private static void Main()
        {
            var demoMode = (ConfigurationManager.AppSettings["ticketdesk:DemoModeEnabled"] ?? "false").Equals("true", StringComparison.InvariantCultureIgnoreCase);
            var isEnabled = false;
            var interval = 2;
            using (var context = new TdPushNotificationContext())
            {
                isEnabled = !demoMode && context.TicketDeskPushNotificationSettings.IsEnabled;
                interval = context.TicketDeskPushNotificationSettings.DeliveryIntervalMinutes;
            }
            var storageConnectionString = AzureConnectionHelper.CloudConfigConnString ??
                                             AzureConnectionHelper.ConfigManagerConnString;
            var host = new JobHost(new JobHostConfiguration(storageConnectionString));
            if (isEnabled)
            {
                host.Call(typeof(Functions).GetMethod("StartNotificationScheduler"), new { interval});
                host.RunAndBlock();
            }
            else
            {
                Console.Out.WriteLine("Push notifications are disabled");
                host.RunAndBlock();//just run and block, to keep from recycling the service over and over
            }


        }
コード例 #6
0
 // Please set the following connection strings in app.config for this WebJob to run:
 // AzureWebJobsDashboard and AzureWebJobsStorage
 static void Main()
 {
     var host = new JobHost();
     // The following code ensures that the WebJob will be running continuously
     //host.RunAndBlock();
     host.Call(typeof(Program).GetMethod("CreateQueueMessage"), new { value = "Hello world!" });
 }
コード例 #7
0
        public int Main(string[] args)
        {
            var builder = new ConfigurationBuilder();
            //builder.Add(new JsonConfigurationSource("config.json"));
            builder.AddJsonFile("config.json");
            var config = builder.Build();
            var webjobsConnectionString = config["Data:AzureWebJobsStorage:ConnectionString"];
            var dbConnectionString = config["Data:DefaultConnection:ConnectionString"];
            if (string.IsNullOrWhiteSpace(webjobsConnectionString))
            {
                Console.WriteLine("The configuration value for Azure Web Jobs Connection String is missing.");
                return 10;
            }

            if (string.IsNullOrWhiteSpace(dbConnectionString))
            {
                Console.WriteLine("The configuration value for Database Connection String is missing.");
                return 10;
            }

            var jobHostConfig = new JobHostConfiguration(config["Data:AzureWebJobsStorage:ConnectionString"]);
            var host = new JobHost(jobHostConfig);
            var methodInfo = typeof(Functions).GetMethods().First();

            host.Call(methodInfo);
            return 0;
        }
コード例 #8
0
ファイル: Program.cs プロジェクト: markjbrown/AzureDmlBackup
        static void Main()
        {
            JobHostConfiguration config = new JobHostConfiguration();

            var host = new JobHost(config);
            
            host.Call(typeof(Functions).GetMethod("QueueBackup"));
        }
コード例 #9
0
        public static void Main(string[] args)
        {
            JobHostConfiguration config = new JobHostConfiguration();

            config.Tracing.ConsoleLevel = TraceLevel.Verbose;

            // Set to a short polling interval to facilitate local
            // debugging. You wouldn't want to run prod this way.
            config.Queues.MaxPollingInterval = TimeSpan.FromSeconds(2);

            FilesConfiguration filesConfig = new FilesConfiguration();
            if (string.IsNullOrEmpty(filesConfig.RootPath))
            {
                // when running locally, set this to a valid directory
                filesConfig.RootPath = @"c:\temp\files";
            }
            EnsureSampleDirectoriesExist(filesConfig.RootPath);
            config.UseFiles(filesConfig);

            config.UseTimers();
            config.UseSample();
            config.UseCore();
            var sendGridConfiguration = new SendGridConfiguration()
            {
                ToAddress = "*****@*****.**",
                FromAddress = new MailAddress("*****@*****.**", "WebJobs Extensions Samples")
            };
            config.UseSendGrid(sendGridConfiguration);

            ConfigureTraceMonitor(config, sendGridConfiguration);

            WebHooksConfiguration webHooksConfig = new WebHooksConfiguration();
            webHooksConfig.UseReceiver<GitHubWebHookReceiver>();
            config.UseWebHooks(webHooksConfig);

            JobHost host = new JobHost(config);

            host.Call(typeof(MiscellaneousSamples).GetMethod("ExecutionContext"));
            host.Call(typeof(FileSamples).GetMethod("ReadWrite"));
            host.Call(typeof(SampleSamples).GetMethod("Sample_BindToStream"));
            host.Call(typeof(SampleSamples).GetMethod("Sample_BindToString"));
            host.Call(typeof(TableSamples).GetMethod("CustomBinding"));

            host.RunAndBlock();
        }
コード例 #10
0
        // Please set the following connection strings in app.config for this WebJob to run:
        // AzureWebJobsDashboard and AzureWebJobsStorage
        static void Main()
        {
            var host = new JobHost();
            // The following code ensures that the WebJob will be running continuously
            Console.WriteLine("starting...");
            host.Call(typeof(Program).GetMethod("RunOnce"));

            //host.RunAndBlock();
        }
コード例 #11
0
ファイル: Program.cs プロジェクト: ucdavis/Commencement
        // Please set the following connection strings in app.config for this WebJob to run:
        // AzureWebJobsDashboard and AzureWebJobsStorage
        public static void Main(string[] args)
        {
            LogHelper.ConfigureLogging();
            Log.Information("Build Number: {buildNumber}", typeof(Program).Assembly.GetName().Version);

            var kernel = ConfigureServices();
            _dbService = kernel.Get<IDbService>();
            var jobHost = new JobHost();
            jobHost.Call(typeof(Program).GetMethod("EmailNotificationDaily"));
        }
コード例 #12
0
        public static void Main(string[] args)
        {
            JobHostConfiguration config = new JobHostConfiguration();
            FilesConfiguration filesConfig = new FilesConfiguration();

            // See https://github.com/Azure/azure-webjobs-sdk/wiki/Running-Locally for details
            // on how to set up your local environment
            if (config.IsDevelopment)
            {
                config.UseDevelopmentSettings();
                filesConfig.RootPath = @"c:\temp\files";
            }

            config.UseFiles(filesConfig);
            config.UseTimers();
            config.UseSample();
            config.UseCore();
            var sendGridConfiguration = new SendGridConfiguration()
            {
                ToAddress = "*****@*****.**",
                FromAddress = new MailAddress("*****@*****.**", "WebJobs Extensions Samples")
            };
            config.UseSendGrid(sendGridConfiguration);

            ConfigureTraceMonitor(config, sendGridConfiguration);
            
            EnsureSampleDirectoriesExist(filesConfig.RootPath);

            WebHooksConfiguration webHooksConfig = new WebHooksConfiguration();
            webHooksConfig.UseReceiver<GitHubWebHookReceiver>();
            config.UseWebHooks(webHooksConfig);

            JobHost host = new JobHost(config);

            host.Call(typeof(MiscellaneousSamples).GetMethod("ExecutionContext"));
            host.Call(typeof(FileSamples).GetMethod("ReadWrite"));
            host.Call(typeof(SampleSamples).GetMethod("Sample_BindToStream"));
            host.Call(typeof(SampleSamples).GetMethod("Sample_BindToString"));
            host.Call(typeof(TableSamples).GetMethod("CustomBinding"));

            host.RunAndBlock();
        }
コード例 #13
0
ファイル: Program.cs プロジェクト: ucdavis/Purchasing
        static void Main(string[] args)
        {
            LogHelper.ConfigureLogging();

            Console.WriteLine("Build Number: {0}", typeof(Program).Assembly.GetName().Version);

            var kernel = ConfigureServices();
            _dbService = kernel.Get<IDbService>();
            var jobHost = new JobHost();
            jobHost.Call(typeof(Program).GetMethod("EmailNotifications"));
        }
コード例 #14
0
ファイル: Program.cs プロジェクト: Data-Online/CimscoManage
 // Please set the following connection strings in app.config for this WebJob to run:
 // AzureWebJobsDashboard and AzureWebJobsStorage
 static void Main()
 {
     var host = new JobHost();
     host.Call(typeof(Program).GetMethod("ProcessMethod"));
     // The following code ensures that the WebJob will be running continuously
     host.RunAndBlock();
     //TextWriter log = null;
     //StorageCredentials credential = new StorageCredentials(ConfigurationManager.AppSettings["AccountName"], ConfigurationManager.AppSettings["AccountKey"]);
     //CloudStorageAccount account = new CloudStorageAccount(credential, true);
     //UploadToBlog(account, log);
 }
コード例 #15
0
ファイル: Program.cs プロジェクト: danieros/SendMail
        // Please set the following connection strings in app.config for this WebJob to run:
        // AzureWebJobsDashboard and AzureWebJobsStorage
        static void Main()
        {

            var host = new JobHost();
            var method = typeof(Program).GetMethod("SendWelcome");
            host.Call(method, new { dummy = "dummy" });


            //var host = new JobHost();
            //// The following code ensures that the WebJob will be running continuously
            //host.RunAndBlock();
        }
コード例 #16
0
        static void Main(string[] args)
        {
            JobHostConfiguration config = new JobHostConfiguration();
            //config.Tracing.Trace = new ConsoleTraceWriter(TraceLevel.Verbose);
            config.UseRedis();
            
            JobHost host = new JobHost(config);
            host.Start();

            // Give subscriber chance to startup
            Task.Delay(5000).Wait();

            host.Call(typeof(Functions).GetMethod("SendSimplePubSubMessage"));
            host.Call(typeof(Functions).GetMethod("SendPubSubMessage"));
            host.Call(typeof(Functions).GetMethod("SendPubSubMessageIdChannel"));
            host.Call(typeof(Functions).GetMethod("AddSimpleCacheMessage"));
            host.Call(typeof(Functions).GetMethod("AddCacheMessage"));
            host.Call(typeof(Functions).GetMethod("AddCacheMessage"));

            Console.CancelKeyPress += (sender, e) =>
            {
                host.Stop();
            };

            while (true)
            {
                Thread.Sleep(500);
            }
        }
コード例 #17
0
ファイル: Program.cs プロジェクト: danieros/GarageSaleMails
        // Please set the following connection strings in app.config for this WebJob to run:
        // AzureWebJobsDashboard and AzureWebJobsStorage
        static void Main(string[] args)
        {

            var host = new JobHost();

            switch (args.Length)
            {
                case 0:
                  var method1 = typeof(Program).GetMethod("SendNotifications");
                    host.Call(method1, new { dummy = "dummy" });
                    break;
                case 1:
                    var method2 = typeof(Program).GetMethod("SendInvites");
                    host.Call(method2, new { dummy = "dummy" });
                    break;
            }

           


            //var host = new JobHost();
            //// The following code ensures that the WebJob will be running continuously
            //host.RunAndBlock();
        }
コード例 #18
0
        public static void Main(string[] args)
        {
            var jobhostConfiguration = new JobHostConfiguration
            {
                StorageConnectionString =
                    "",
                DashboardConnectionString =
                    ""
            };

            jobhostConfiguration.UseFtp();

            using (var host = new JobHost(jobhostConfiguration))
            {
                host.Call(typeof(Functions).GetMethod("SendFileToFtps"));
            }
        }
コード例 #19
0
 static void Main()
 {
     var host = new JobHost();
     host.Call(typeof(Functions).GetMethod("UpdateTotals"));
 }
コード例 #20
0
ファイル: Program.cs プロジェクト: tandis/PnP
 // Please set the following connection strings in app.config for this WebJob to run:
 // AzureWebJobsDashboard and AzureWebJobsStorage
 static void Main()
 {
     // The following code will invoke a function called VerifyDocLib
     var host = new JobHost();
     host.Call(typeof(Functions).GetMethod("VerifyDocLib"));
 }
コード例 #21
0
ファイル: Program.cs プロジェクト: dzimchuk/SASRotation
 static void Main()
 {
     var host = new JobHost();
     host.Call(typeof(Functions).GetMethod("RegenerateKey"));
 }
コード例 #22
0
 static void Main()
 {
     var host = new JobHost();
     host.Call(typeof(Functions).GetMethod("RefillSearchIndex"));
 }
コード例 #23
0
ファイル: Program.cs プロジェクト: mbgreen/GHV
 // Please set the following connection strings in app.config for this WebJob to run:
 // AzureWebJobsDashboard and AzureWebJobsStorage
 static void Main()
 {
     var host = new JobHost();
     // The following code ensures that the WebJob will be running continuously
     host.Call(typeof(Program).GetMethod("MyAwesomeWebJobMethod"));
 }
コード例 #24
0
 public static void Main()
 {
     JobHost jobHost = new JobHost();
     jobHost.Call(typeof(Cleanup).GetMethod("CleanupFunction"));
 }
コード例 #25
0
ファイル: Program.cs プロジェクト: nHook/nH.Api
		public static void Main()
		{
			var host = new JobHost();
			host.Call(typeof(Functions).GetMethod("ManualTrigger"));
		}
コード例 #26
0
ファイル: Program.cs プロジェクト: rustd/SiteMonitR
 static void Main(string[] args)
 {
     JobHost host = new JobHost();
     var methodInfo = typeof(Program).GetMethod("CheckSitesFunction");
     host.Call(methodInfo);
 }
コード例 #27
-1
        static void Main(string[] args)
        {
            JobHostConfiguration config = new JobHostConfiguration();

            config.Tracing.ConsoleLevel = TraceLevel.Verbose;

            // Set to a short polling interval to facilitate local
            // debugging. You wouldn't want to run prod this way.
            config.Queues.MaxPollingInterval = TimeSpan.FromSeconds(2);

            FilesConfiguration filesConfig = new FilesConfiguration();
            if (string.IsNullOrEmpty(filesConfig.RootPath))
            {
                // when running locally, set this to a valid directory
                filesConfig.RootPath = @"c:\temp\files";
            };
            EnsureSampleDirectoriesExist(filesConfig.RootPath);
            config.UseFiles(filesConfig);

            config.UseTimers();
            config.UseSample();
            config.UseCore();

            JobHost host = new JobHost(config);

            host.Call(typeof(FileSamples).GetMethod("ReadWrite"));
            host.Call(typeof(SampleSamples).GetMethod("Sample_BindToStream"));
            host.Call(typeof(SampleSamples).GetMethod("Sample_BindToString"));
            host.Call(typeof(TableSamples).GetMethod("CustomBinding"));

            host.RunAndBlock();
        }