当前位置:网站首页>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
边栏推荐
- Clickhouse SQL operation
- Customize my_ Strcpy and library strcpy [analog implementation of string related functions]
- How vscode compares the similarities and differences between two files
- Zhimeng dedecms security setup Guide
- On lambda powertools typescript
- Shell-入门、变量、以及基本的语法
- 快时钟同步慢时钟域下的异步控制信号slow clk to fast clk
- Go language, array, string, slice
- Feign report 400 processing
- Use of shell awk command
猜你喜欢
Milvus 2.0 質量保障系統詳解
Sub database and sub table & shardingsphere
JS, entries(), keys(), values(), some(), object Assign() traversal array usage
. net cross platform principle (Part I)
Get the column name list of the table quickly in Oracle
Understanding of RPC core concepts
[PROJECT] small hat takeout (8)
On lambda powertools typescript
Net standard
Shell script -- shell programming specification and variables
随机推荐
Read a blog, re understand closures and tidy up
RPC核心概念理解
[pimf] openharmony paper Club - what is the experience of wandering in ACM survey
网络安全之渗透靶场实战详解
拷贝构造函数 浅拷贝与深拷贝
Production environment——
Error in v-on handler: "typeerror: cannot read property 'resetfields' of undefined"
Shell-sort命令的使用
如何用Redis实现分布式锁?
Aiot industrial technology panoramic structure - Digital Architecture Design (8)
杂文 谈谈古典的《拆掉思维里的墙》
Wiper component encapsulation
Paging the list collection
Nodejs installation and environment configuration
Deeply understand the relevant knowledge of 3D model (modeling, material mapping, UV, normal), and the difference between displacement mapping, bump mapping and normal mapping
Understanding of RPC core concepts
Promise (III)
Shell script -- shell programming specification and variables
Talk about browser cache control
Use of shell sed command