Exemplo n.º 1
0
        // 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
            }


        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            var host = new JobHost();
            Console.Error.Write("An error occurred in this web job");

            host.RunAndBlock();
        }
Exemplo n.º 3
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(webjobsConnectionString);
            var host = new JobHost(jobHostConfig);

            host.RunAndBlock();
            return 0;
        }
 static void Main()
 {
     var host = new JobHost();
     // The following code ensures that the WebJob will be running continuously
     var TWITTERAPPACCESSTOKEN = ConfigurationManager.AppSettings["TWITTERAPPACCESSTOKEN"];
     var TWITTERAPPACCESSTOKENSECRET = ConfigurationManager.AppSettings["TWITTERAPPACCESSTOKENSECRET"];
     var TWITTERAPPAPIKEY = ConfigurationManager.AppSettings["TWITTERAPPAPIKEY"];
     var TWITTERAPPAPISECRET = ConfigurationManager.AppSettings["TWITTERAPPAPISECRET"];
     var trackersKeywords = ConfigurationManager.AppSettings["TrackerKeywords"];
     var pusherAppId = ConfigurationManager.AppSettings["PusherAppId"];
     var pusherAppKey = ConfigurationManager.AppSettings["PusherAppId"];
     var pusherAppSecret = ConfigurationManager.AppSettings["PusherAppId"];
     var pusherChannel = ConfigurationManager.AppSettings["PusherAppId"];
     var pusherEvent = ConfigurationManager.AppSettings["PusherAppId"];
     var pusherConfig = new PusherConfig {
          AppId = pusherAppId,
          AppKey = pusherAppKey,
          AppSecret = pusherAppSecret,
          Channel = pusherChannel,
          Event = pusherEvent
     };
     Auth.SetUserCredentials(TWITTERAPPAPIKEY, TWITTERAPPAPISECRET, TWITTERAPPACCESSTOKEN, TWITTERAPPACCESSTOKENSECRET);
     Auth.ApplicationCredentials = new TwitterCredentials(TWITTERAPPAPIKEY, TWITTERAPPAPISECRET, TWITTERAPPACCESSTOKEN, TWITTERAPPACCESSTOKENSECRET);
     Program p = new Program();
     p.Stream_FilteredStreamExample(trackersKeywords, pusherConfig);
     host.RunAndBlock();
 }
Exemplo n.º 5
0
        static void Main()
        {
            CreateDemoData();

            JobHost host = new JobHost();
            host.RunAndBlock();
        }
		static void Main()
		{
			_servicesBusConnectionString = AmbientConnectionStringProvider.Instance.GetConnectionString(ConnectionStringNames.ServiceBus);
			namespaceManager = NamespaceManager.CreateFromConnectionString(_servicesBusConnectionString);

			if (!namespaceManager.QueueExists(nameof(Step1)))
			{
				namespaceManager.CreateQueue(nameof(Step1));
			}
			if (!namespaceManager.QueueExists(nameof(Step2)))
			{
				namespaceManager.CreateQueue(nameof(Step2));
			}

			JobHostConfiguration config = new JobHostConfiguration();
			config.UseServiceBus();



			var host = new JobHost(config);

			CreateStartMessage();

			host.RunAndBlock();
		}
Exemplo n.º 7
0
 // Please set the following connection strings in app.config for this WebJob to run:
 // AzureWebJobsDashboard and AzureWebJobsStorage
 static void Main()
 {
     var config = new JobHostConfiguration();
     config.UseTimers();
     var host = new JobHost(config);
     host.RunAndBlock();
 }
Exemplo n.º 8
0
 static void JobHost()
 {
     var config = new JobHostConfiguration();
     var host = new JobHost(config);
     host.RunAndBlock();
     host.Start();
 }
Exemplo n.º 9
0
 // Please set the following connection strings in app.config for this WebJob to run:
 // AzureWebJobsDashboard and AzureWebJobsStorage
 static void Main()
 {
     JobHostConfiguration config = new JobHostConfiguration();
       config.UseServiceBus();
       JobHost host = new JobHost(config);
       host.RunAndBlock();
 }
Exemplo n.º 10
0
        public static void Main(string[] args)
        {
            // Set up default WebHook logger
            ILogger logger = new TraceLogger();

            // Set the WebHook Store we want to get WebHook subscriptions from. Azure store requires
            // a valid Azure Storage connection string named MS_AzureStoreConnectionString.
            IWebHookStore store = AzureWebHookStore.CreateStore(logger);

            // Set the sender we want to actually send out the WebHooks. We could also 
            // enqueue messages for scale out.
            IWebHookSender sender = new DataflowWebHookSender(logger);

            // Set up WebHook manager which we use for creating notifications.
            Manager = new WebHookManager(store, sender, logger);

            // Initialize WebJob
            var listener = ConfigurationManager.ConnectionStrings["WebHookListener"].ConnectionString;
            JobHostConfiguration config = new JobHostConfiguration
            {
                StorageConnectionString = listener
            };
            JobHost host = new JobHost(config);
            host.RunAndBlock();
        }
Exemplo n.º 11
0
 static void Main()
 {
     Initialize();
     var storageConnectionString = AzureConnectionHelper.CloudConfigConnString ?? AzureConnectionHelper.ConfigManagerConnString;
     var host = new JobHost(new JobHostConfiguration(storageConnectionString));
     host.RunAndBlock();
 }
Exemplo n.º 12
0
    static void Main()
        {
            // setup unobserved exceptions
            TaskScheduler.UnobservedTaskException += Program.handleUnObservedExceptions;



         // Setup configuration sources.
        Configuration = new Configuration()
                .AddEnvironmentVariables("APPSETTING_");

            var storageCstr = GetConnectionString();

            JobHostConfiguration config = new JobHostConfiguration(storageCstr);
            config.Queues.BatchSize = 1; //Number of messages parallel processed in parallel. Will need some concurrency check before increasing.
            config.Queues.MaxDequeueCount = 4;
            config.Queues.MaxPollingInterval = TimeSpan.FromSeconds(15);
            JobHost host = new JobHost(config);
            Console.WriteLine("Web Job starting..");

            // TEST Lines
            //ProvisioningLibrary.WebJobController w = new WebJobController(Configuration);
            //w.SubmitActionInQueue("8fd8fbfc-8fb6-4e95-ae17-aa4779423cb8", ResourceAction.Start );

            // The following code ensures that the WebJob will be running continuously
            host.RunAndBlock();
        }
        // Please set the following connection strings in app.config for this WebJob to run:
        // AzureWebJobsDashboard and AzureWebJobsStorage
        static void Main()
        {
            var config = new JobHostConfiguration();
            var slackConfig = new SlackConfiguration();
            WebHooksConfiguration webhookConfig;

            if(config.IsDevelopment)
            {
                config.UseDevelopmentSettings();
                webhookConfig = new WebHooksConfiguration(3000);
            }
            else
            {
                webhookConfig = new WebHooksConfiguration();
            }

            // These are optional and will be applied if no other value is specified.
            /*
            slackConfig.WebHookUrl = "";
            // IT IS A BAD THING TO HARDCODE YOUR WEBHOOKURL, USE THE APP SETTING "AzureWebJobsSlackWebHookKeyName"
            slackConfig.IconEmoji = "";
            slackConfig.Username = "";
            slackConfig.Channel = "";
            */

            config.UseSlack(slackConfig);
            config.UseWebHooks(webhookConfig);

            var host = new JobHost(config);
            // The following code ensures that the WebJob will be running continuously
            host.RunAndBlock();
        }
        // Please set the following connection strings in app.config for this WebJob to run:
        // AzureWebJobsDashboard and AzureWebJobsStorage
        static void Main()
        {
            Console.WriteLine("*************************************************************************");
            Console.WriteLine("WebJobUsageHistory:Main starting. DateTimeUTC: {0}", DateTime.UtcNow);

            /*/
            DateTime sdt = DateTime.Now.AddYears(-3);
            DateTime edt = DateTime.Now.AddDays(-1);
            BillingRequest br = new BillingRequest("30d4242f-1afc-49d9-a993-59d0de83b5bd",
                                                    "72f988bf-86f1-41af-91ab-2d7cd011db47",
                                                    sdt, //Convert.ToDateTime("2015-10-28 00:00:00.000"),
                                                    edt);//Convert.ToDateTime("2015-10-29 00:00:00.000"));
            Functions.ProcessQueueMessage(br);
            return;
            /**/

            JobHostConfiguration config = new JobHostConfiguration();
            config.Queues.BatchSize = 3;
            config.Queues.MaxDequeueCount = 3;
            config.Queues.MaxPollingInterval = TimeSpan.FromSeconds(15);

            var host = new JobHost(config);
            // The following code ensures that the WebJob will be running continuously
            host.RunAndBlock();
        }
Exemplo n.º 15
0
        public static void Main()
        {
            var webJobsDashboard = CloudConfigurationManager.GetSetting("AzureWebJobsDashboard");
            var webJobsStorage = CloudConfigurationManager.GetSetting("AzureWebJobsStorage");
            var storageAcc = CloudConfigurationManager.GetSetting("StorageAccount");

            if (string.IsNullOrWhiteSpace(webJobsStorage) || string.IsNullOrWhiteSpace(storageAcc) || string.IsNullOrWhiteSpace(webJobsDashboard))
            {
                Console.WriteLine("Please add the Azure Storage account credentials ['StorageAccount' & 'AzureWebJobsStorage' & 'AzureWebJobsDashboard'] in App.config");
                Console.Read();
                return;
            }
            else
            {
                var config = new TaskConfiguration()
                {
                    ConnectionString = storageAcc,
                    StorageElements = new StorageElements(),
                };

                var factory = new ImageTaskFactory();
                foreach (var task in factory.Initialize(config))
                {
                    task.Start();
                }

                var host = new JobHost();
                host.RunAndBlock();
            }
        }
Exemplo n.º 16
0
        public static void Main()
        {
     //       string connectionString =
     //ConfigurationManager.ConnectionStrings["RootManageSharedAccessKey"].ConnectionString;
     //       Action<BrokeredMessage> callback = x =>
     //       {
                
     //       };
     //       var clients = new List<SubscriptionClient>();
     //       for (int i = 0; i < 5; i++)
     //       {
     //           var client = TopicClient.CreateFromConnectionString(connectionString, "signalr_topic_push_" + i);
     //           client.
     //           client.OnMessage(callback);
     //           clients.Add(client);
     //       }
     //       Console.ReadLine();
            //var ctx = GlobalHost.ConnectionManager.GetHubContext<yourhub>();
            //ctx.Clients.Client(connectionId).< your method >

            var cloudStorage = CloudStorageAccount.Parse(ConfigurationManager.ConnectionStrings["DataStorage"].ConnectionString);
            var tableClient = cloudStorage.CreateCloudTableClient();
            _tickEvents = tableClient.GetTableReference("tickevents");
            _tickEvents.CreateIfNotExists();
            var host = new JobHost();
            var cancelToken = new WebJobsShutdownWatcher().Token;
            _eventHubClient = EventHubClient.CreateFromConnectionString(ConfigurationManager.ConnectionStrings["IotHubConnection"].ConnectionString, iotHubD2cEndpoint);
            var d2CPartitions = _eventHubClient.GetRuntimeInformation().PartitionIds;
            Task.WaitAll(d2CPartitions.Select(partition => ListenForEvent(host, partition, cancelToken)).ToArray(), cancelToken);
            host.RunAndBlock();
        }
Exemplo n.º 17
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();
 }
Exemplo n.º 18
0
 // Please set the following connection strings in app.config for this WebJob to run:
 // AzureWebJobsDashboard and AzureWebJobsStorage
 static void Main()
 {
     JobHostConfiguration config = new JobHostConfiguration();
     config.Queues.MaxPollingInterval = TimeSpan.FromSeconds(15);
     var host = new JobHost(config);
     // The following code ensures that the WebJob will be running continuously
     host.RunAndBlock();
 }
Exemplo n.º 19
0
        // Please set the following connection strings in app.config for this WebJob to run:
        // AzureWebJobsDashboard and AzureWebJobsStorage
        static void Main()
        {
            MessageSender.NotifyCompleted = SentNotification.Notify;

            var host = new JobHost();
            // The following code ensures that the WebJob will be running continuously
            host.RunAndBlock();
        }
Exemplo n.º 20
0
        // Please set the following connection strings in app.config for this WebJob to run:
        // AzureWebJobsDashboard and AzureWebJobsStorage
        static void Main()
        {
            var config = new JobHostConfiguration();
            config.UseTimers();

            var host = new JobHost(config);
            // The following code ensures that the WebJob will be running continuously
            host.RunAndBlock();
        }
Exemplo n.º 21
0
        static void Main()
        {
            JobHostConfiguration config = new JobHostConfiguration();
            CustomQueueProcessorFactory queueProcessorFactory = new CustomQueueProcessorFactory();
            config.Queues.QueueProcessorFactory = queueProcessorFactory;

            var host = new JobHost(config);
            host.RunAndBlock();
        }
Exemplo n.º 22
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.RunAndBlock();
 }
Exemplo n.º 23
0
 // Please set the following connection strings in app.config for this WebJob to run:
 // AzureWebJobsDashboard and AzureWebJobsStorage
 static void Main()
 {
     JobHostConfiguration config = new JobHostConfiguration();
     config.StorageConnectionString = SettingsHelper.AzureWebJobsStorage;
     config.DashboardConnectionString = SettingsHelper.AzureWebJobsDashboard;
     var host = new JobHost(config);
     // The following code ensures that the WebJob will be running continuously
     host.RunAndBlock();
 }
Exemplo n.º 24
0
 // Please set the following connection strings in app.config for this WebJob to run:
 // AzureWebJobsDashboard and AzureWebJobsStorage
 static void Main()
 {
     _host = new JobHost();
     var connectionString = ConfigurationManager.ConnectionStrings["IoTHub"].ConnectionString;
     _eventHubClient = EventHubClient.CreateFromConnectionString(connectionString, "messages/events");
     _serviceClient = ServiceClient.CreateFromConnectionString(connectionString);
     Task.WaitAll(_eventHubClient.GetRuntimeInformation().PartitionIds.Select(Listen).ToArray());
     _host.RunAndBlock();
 }
        static void Main()
        {
            var configuration = new JobHostConfiguration()
            {
                NameResolver = new ConfigurationNameResolver(),
            };

            var host = new JobHost(configuration);
            host.RunAndBlock();
        }
Exemplo n.º 26
0
        static void Main()
        {
            InitializeAppInsights();

            var container = InitializeContainer();
            var config = new JobHostConfiguration { JobActivator = new AutofacJobActivator(container) };

            var host = new JobHost(config);
            host.RunAndBlock();
        }
Exemplo n.º 27
0
        // Please set the following connection strings in app.config for this WebJob to run:
        // AzureWebJobsDashboard and AzureWebJobsStorage
        static void Main()
        {
            var config = new JobHostConfiguration();
            // Make sure an item can only be picked up once, otherwise you get errors
            config.Queues.MaxDequeueCount = 1;
            var host = new JobHost(config);

            // The following code ensures that the WebJob will be running continuously
            host.RunAndBlock();
        }
Exemplo n.º 28
0
        static void Main()
        {
            //Generate between 1 and 1000 cars and put them on the road
            string factoryId = "Factory-" + Guid.NewGuid().ToString();
            Functions.GenerateCars(factoryId, (new Random()).Next(1, 1000));

            var host = new JobHost();
            // The following code ensures that the WebJob will be running continuously
            host.RunAndBlock();
        }
Exemplo n.º 29
0
        // Please set the following connection strings in app.config for this WebJob to run:
        // AzureWebJobsDashboard and AzureWebJobsStorage
        static void Main()
        {
            var cs = CloudConfigurationManager.GetSetting("Microsoft.ServiceBus.ConnectionString");
            var config = new JobHostConfiguration();
            config.UseServiceBus();
            var host = new JobHost(config);
            // The following code ensures that the WebJob will be running continuously

            host.RunAndBlock();
        }
Exemplo n.º 30
-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();
        }