private static void CreateNewJob(Guid?uniqueId, string name, string description, string data, string metaData, string jobType, TimeSpan?absoluteTimeout, byte queueId, string application, string group, bool suppressHistory, bool deleteWhenDone, SimpleSchedule schedule) { CreateJobRequest request = new CreateJobRequest { UniqueId = uniqueId, Application = application, DeleteWhenDone = deleteWhenDone, Description = description, Name = name, QueueId = queueId, Type = jobType, MetaData = metaData, Data = data, SuppressHistory = suppressHistory, AbsoluteTimeout = absoluteTimeout, Group = group, Status = JobStatus.Pending, }; if (schedule != null) { if (!schedule.StartDailyAt.HasValue) { schedule.StartDailyAt = new TimeSpan(); } request.CalendarSchedule = new CalendarSchedule { ScheduleType = typeof(global::BackgroundWorkerService.Logic.DataModel.Scheduling.CalendarSchedule).AssemblyQualifiedName, DaysOfWeek = schedule.DaysOfWeek.ToArray(), StartDailyAt = new TimeOfDay { Hour = schedule.StartDailyAt.Value.Hours, Minute = schedule.StartDailyAt.Value.Minutes, Second = schedule.StartDailyAt.Value.Seconds }, RepeatInterval = schedule.RepeatInterval, EndDateTime = null, StartDateTime = !string.IsNullOrEmpty(schedule.StartDateTime) ? DateTime.ParseExact(schedule.StartDateTime, "dd-MM-yyyy HH:mm:ss", CultureInfo.CurrentCulture) : DateTime.Now, }; } using (AccessPointClient client = new AccessPointClient()) { client.CreateJob(request); } }
private static void CreateNewJob(string name, string description, string data, string metaData, string jobType, TimeSpan?absoluteTimeout, byte queueId, string application, string group, bool suppressHistory, bool deleteWhenDone) { CreateJobRequest request = new CreateJobRequest { Application = application, DeleteWhenDone = deleteWhenDone, Description = description, Name = name, QueueId = queueId, Type = jobType, MetaData = metaData, Data = data, SuppressHistory = suppressHistory, AbsoluteTimeout = absoluteTimeout, Group = group, }; using (AccessPointClient client = new AccessPointClient()) { client.CreateJob(request); } }
static void Main(string[] args) { using (AccessPointClient client = new AccessPointClient()) { for (int i = 0; i < 100; i++) { var job = client.CreateJob(new CreateJobRequest { Type = typeof(BackgroundWorkerService.Logic.TestJobs.ShortRunningJob).AssemblyQualifiedName, QueueId = (byte)new Random().Next(3), Name = "Job " + new Random().Next(int.MaxValue), Description = "This is a test description to see what it looks like : " + new Random().Next(int.MaxValue), Status = JobStatus.Ready, }); } //for (int i = 0; i < 20; i++) //{ // var job = client.CreateJob(new CreateJobRequest // { // Data = "bob", // MetaData = // JobBuilder.CreateBasicHttpSoap_BasicCallbackJobMetaData( // "metaData", // "http://*****:*****@b.com", "*****@*****.**"), null, out data, out metadata); //var job3 = client.CreateJob(new CreateJobRequest //{ // Data = data, // MetaData = metadata, // Type = typeof(SendMailJob).AssemblyQualifiedName, // QueueId = 1, // CalendarSchedule = new CalendarSchedule // { // ScheduleType = typeof(BackgroundWorkerService.Logic.DataModel.Scheduling.CalendarSchedule).AssemblyQualifiedName, //Must set this // DaysOfWeek = new List<DayOfWeek> { DayOfWeek.Monday }.ToArray(), // StartDateTime = DateTime.Now, // StartDailyAt = new TimeOfDay { Hour = 0, Minute = 30, Second = 0 }, // } //}); //var job4 = client.CreateJob(new CreateJobRequest //{ // Data = "", // MetaData = // JobBuilder.GetWebRequestJobMetaData( // "http://localhost:2048/default.aspx", // System.Net.HttpStatusCode.OK, // true).Serialize(), // Type = typeof(WebRequestJob).AssemblyQualifiedName, // QueueId = 0, // DeleteWhenDone = false, // SuppressHistory = false, // Name = "Ping Service WebUI", // Description = "This pings the web ui to check whether it's still running.", //}); } }
static void Main(string[] args) { using (AccessPointClient client = new AccessPointClient()) { var job = client.CreateJob(new CreateJobRequest { Data = "bob", MetaData = JobBuilder.CreateBasicHttpSoap_BasicCallbackJobMetaData( "metaData", "http://*****:*****@b.com", "*****@*****.**"), null, out data, out metadata); var job3 = client.ScheduleJob(new ScheduleJobRequest { Data = data, MetaData = metadata, Type = typeof(SendMailJob).AssemblyQualifiedName, QueueId = 1, CalendarSchedule = new CalendarSchedule { ScheduleType = typeof(BackgroundWorkerService.Logic.DataModel.Scheduling.CalendarSchedule).AssemblyQualifiedName, //Must set this DaysOfWeek = new List <DayOfWeek> { DayOfWeek.Monday }.ToArray(), StartDateTime = DateTime.Now, StartDailyAt = new TimeOfDay { Hour = 0, Minute = 30, Second = 0 }, } }); var job4 = client.CreateJob(new CreateJobRequest { Data = "", MetaData = JobBuilder.GetWebRequestJobMetaData( "http://localhost:2048/default.aspx", System.Net.HttpStatusCode.OK, true).Serialize(), Type = typeof(WebRequestJob).AssemblyQualifiedName, QueueId = 0, DeleteWhenDone = false, SuppressHistory = false, Name = "Ping Service WebUI", Description = "This pings the web ui to check whether it's still running.", }); } }