示例#1
0
        public void Execute(TestJobArg arg, PerformContext context = null)
        {
            Console.WriteLine(arg.ToString());

            context.LogInformation($" info - {arg}");
            context.WriteLine($" context - {arg} ");
        }
示例#2
0
        public IActionResult Index3()
        {
            var testJob = new TestJobArg
            {
                Id = (int)DateTime.Now.Ticks
            };

            var t1 = _backgroundJobClient.Enqueue <TestJob3>(a => a.Execute(testJob, null));

            Console.WriteLine($" t1 - {t1}");

            return(Ok());
        }
示例#3
0
        public IActionResult Index2()
        {
            var testJob = new TestJobArg
            {
                Id = 123
            };

            var customTimeZone = TimeZoneInfo.CreateCustomTimeZone("Asia/Taipei",
                                                                   new TimeSpan(08, 00, 00),
                                                                   "tw +8",
                                                                   "Asia/Taipei");

            RecurringJob.AddOrUpdate <TestJob2>($"jobname444 {Guid.NewGuid()}", a => a.Execute(testJob, null),
                                                "10 11 * * *",
                                                customTimeZone);

            return(Ok());
        }
示例#4
0
        public IActionResult Index()
        {
            var testJob = new TestJobArg
            {
                Id = 123
            };

            var t1 = _backgroundJobClient.Enqueue <TestJob>(a => a.Execute(testJob, null));

            Console.WriteLine($" t1 - {t1}");

            // RecurringJob.AddOrUpdate<TestJob2>(a => a.Execute(testJob, null), Cron.Minutely);

            // testJob = new TestJobArg
            // {
            //     Id = 456
            // };
            //
            // var t2 = _backgroundJobClient.Schedule<TestJob>(a => a.Execute(testJob, null), TimeSpan.FromMinutes(1));
            //
            // Console.WriteLine($" t2 - {t2}");

            return(Ok());
        }
示例#5
0
        public void Execute(TestJobArg arg, PerformContext context)
        {
            Console.WriteLine(arg.ToString());

            context.WriteLine($" context - {arg} ");
        }