Parcourir la source

update document

xuxueli il y a 5 ans
Parent
révision
c042cb1504

+ 0 - 2
doc/XXL-JOB-English-Documentation.md Voir le fichier

603
     - 1, create new java class implent com.xxl.job.core.handler.IJobHandler;
603
     - 1, create new java class implent com.xxl.job.core.handler.IJobHandler;
604
     - 2, if you add @Component annotation on the top of the class name it’s will be managed as a bean instance by spring container;
604
     - 2, if you add @Component annotation on the top of the class name it’s will be managed as a bean instance by spring container;
605
     - 3, add  “@JobHandler(value=" customize jobhandler name")” annotation,the value stand for JobHandler name,it will be used as JobHandler property when create a new task in the schedule center.
605
     - 3, add  “@JobHandler(value=" customize jobhandler name")” annotation,the value stand for JobHandler name,it will be used as JobHandler property when create a new task in the schedule center.
606
-    (go and see DemoJobHandler in the xxl-job-executor-example project, as shown below)
607
 
606
 
608
-![输入图片说明](https://www.xuxueli.com/doc/static/xxl-job/images/img_oLlM.png "在这里输入图片标题")
609
 
607
 
610
 #### Step 2:create task in schedule center
608
 #### Step 2:create task in schedule center
611
 If you want learn more about configure item please go and sedd “Description of configuration item”,select  "BEAN模式" as run mode,property JobHandler please fill in the value defined by @JobHande.
609
 If you want learn more about configure item please go and sedd “Description of configuration item”,select  "BEAN模式" as run mode,property JobHandler please fill in the value defined by @JobHande.

+ 14 - 8
doc/XXL-JOB官方文档.md Voir le fichier

685
     - 执行参数:任务执行所需的参数;
685
     - 执行参数:任务执行所需的参数;
686
     
686
     
687
 ### 3.1 BEAN模式
687
 ### 3.1 BEAN模式
688
-任务逻辑以JobHandler的形式存在于“执行器”所在项目中,开发流程如下:
688
+任务逻辑以注解方法的形式存在于“执行器”所在项目中(任务方法底层会自动生成代理JobHandler),开发流程如下:
689
 
689
 
690
-#### 步骤一:执行器项目中,开发JobHandler
690
+#### 步骤一:执行器项目中,开发Job方法
691
 
691
 
692
-     - 1、继承"IJobHandler":“com.xxl.job.core.handler.IJobHandler”;
693
-     - 2、注册到Spring容器:添加“@Component”注解,被Spring容器扫描为Bean实例;
694
-     - 3、注册到执行器工厂:添加“@JobHandler(value="自定义jobhandler名称")”注解,注解value值对应的是调度中心新建任务的JobHandler属性的值。
695
-     - 4、执行日志:需要通过 "XxlJobLogger.log" 打印执行日志;
696
-    (可参考Sample示例执行器中的DemoJobHandler,见下图)
692
+    - 1、在Spring Bean实例中,开发Job方法,方式格式要求为 "public ReturnT<String> execute(String param)"
693
+    - 2、为Job方法添加注解 "@XxlJob(value="自定义jobhandler名称", init = "JobHandler初始化方法", destroy = "JobHandler销毁方法")",注解value值对应的是调度中心新建任务的JobHandler属性的值。
694
+    - 3、执行日志:需要通过 "XxlJobLogger.log" 打印执行日志;
695
+    
696
+```
697
+// 可参考Sample示例执行器中的 "com.xxl.job.executor.service.jobhandler.SampleXxlJob" ,如下:
698
+@XxlJob("demoJobHandler")
699
+public ReturnT<String> execute(String param) {
697
 
700
 
698
-![输入图片说明](https://www.xuxueli.com/doc/static/xxl-job/images/img_oLlM.png "在这里输入图片标题")
701
+    XxlJobLogger.log("hello world.");
702
+    return ReturnT.SUCCESS;
703
+}
704
+```
699
 
705
 
700
 #### 步骤二:调度中心,新建调度任务
706
 #### 步骤二:调度中心,新建调度任务
701
 参考上文“配置属性详细说明”对新建的任务进行参数配置,运行模式选中 "BEAN模式",JobHandler属性填写任务注解“@JobHandler”中定义的值;
707
 参考上文“配置属性详细说明”对新建的任务进行参数配置,运行模式选中 "BEAN模式",JobHandler属性填写任务注解“@JobHandler”中定义的值;

BIN
doc/images/img_oLlM.png Voir le fichier


+ 2 - 2
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/service/jobhandler/SampleXxlJob.java Voir le fichier

22
     @XxlJob("demoJobHandler2")
22
     @XxlJob("demoJobHandler2")
23
     public ReturnT<String> execute(String param) {
23
     public ReturnT<String> execute(String param) {
24
 
24
 
25
-        XxlJobLogger.log("222");
25
+        XxlJobLogger.log("hello world.");
26
         return ReturnT.SUCCESS;
26
         return ReturnT.SUCCESS;
27
     }
27
     }
28
 
28
 
29
     @XxlJob(value="demoJobHandler3", init = "init", destroy = "destory")
29
     @XxlJob(value="demoJobHandler3", init = "init", destroy = "destory")
30
     public ReturnT<String> execute3(String param) {
30
     public ReturnT<String> execute3(String param) {
31
 
31
 
32
-        XxlJobLogger.log("333");
32
+        XxlJobLogger.log("hello world.");
33
         return ReturnT.SUCCESS;
33
         return ReturnT.SUCCESS;
34
     }
34
     }
35
 
35