当前位置:网站首页>Using quartz under. Net core -- preliminary understanding of [2] operations and triggers
Using quartz under. Net core -- preliminary understanding of [2] operations and triggers
2022-04-23 17:10:00 【Tomato Warrior】
Catalog
2、 What is? Quartz Homework in
In the last one , We implemented a simple job scheduling , Next, we will have a preliminary understanding of Quartz Homework in (Job)
1、 Key interfaces and classes
IScheduler
- The main way to interact with the scheduler API.IJob
- The interface implemented by the component you want the scheduler to execute .IJobDetail
- Used for definition Jobs Example .ITrigger
- A component that defines a schedule that will execute a given job , The job can have multiple associated triggersJobBuilder
- Used for definition / structure JobDetail example , This instance defines Jobs Example .TriggerBuilder
- Used for definition / Instance building triggers .SchedulerBuilder
- Used for definition / Build scheduler instance , need Quartz 3.1 Or later .
The above part is directly excerpted from the official website , Before you know the job , Let's familiarize ourselves with the above interfaces and classes , This is very helpful for the next study
2、 What is? Quartz Homework in
The job is to realize IJob
The class of the interface , The interface has only one simple method :
namespace Quartz
{
public interface IJob
{
Task Execute(JobExecutionContext context);
}
}
Review our custom in the last article HelloJob, We did IJob Interface , And realize the unique Execute Method , That's it .
public class HelloJob : IJob
{
public async Task Execute(IJobExecutionContext context)
{
await Console.Out.WriteLineAsync($"{DateTime.Now}");
}
}
3、 Job execution context
Execure In the method , Conveys a parameter ,IJobExecutionContext context
JobExecutionContext Contained in the
“ Runtime ” Information about the environment - Handle to the scheduler executing the job , Handle to trigger execution , Operational JobDetail object , And some other projects .
4、 Job unique ID
Review the code when creating the job in the previous section
IJobDetail job = JobBuilder.Create<HelloJob>()
.WithIdentity("job1", "jobGroup1")
.Build();
Here we name our homework job1, And assigned to jobGroup1 Group , Then the only identification of the job is separated by dots "jobGroup1.job1"
The same is true for triggers
版权声明
本文为[Tomato Warrior]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230553457897.html
边栏推荐
- 快时钟同步慢时钟域下的异步控制信号slow clk to fast clk
- PHP高效读大文件处理数据
- Clickhouse table engine
- Node access to Alipay open platform sandbox to achieve payment function
- Change the password after installing MySQL in Linux
- freeCodeCamp----prob_ Calculator exercise
- SPC introduction
- Error in v-on handler: "typeerror: cannot read property 'resetfields' of undefined"
- matlab如何绘制已知公式的曲线图,Excel怎么绘制函数曲线图像?
- [WPF binding 3] listview basic binding and data template binding
猜你喜欢
Document operation II (5000 word summary)
Detailed explanation of C webpai route
Nodejs installation and environment configuration
1-4 configuration executable script of nodejs installation
STM32__ 03 - beginner timer
基于51单片机红外无线通讯仿真
Lock锁
CentOS MySQL multi instance deployment
网络安全之渗透靶场实战详解
2.Electron之HelloWorld
随机推荐
Conversion between hexadecimal numbers
Input file upload
MySQL master-slave configuration under CentOS
Paging the list collection
Collect blog posts
Some problems encountered in recent programming 2021 / 9 / 8
Zhimeng dedecms security setup Guide
Shell-sed命令的使用
1-1 NodeJS
Preliminary understanding of promse
Use of shell awk command
1-3 nodejs installation list configuration and project environment
Decimal format decimal / datetime conversion processing
Copy constructor shallow copy and deep copy
SQL database
PHP高效读大文件处理数据
Milvus 2.0 質量保障系統詳解
CentOS MySQL multi instance deployment
matlab如何绘制已知公式的曲线图,Excel怎么绘制函数曲线图像?
Idea of batch manufacturing test data, with source code