commit 6e6ef32f8f443a06ed3f5e46e9030d5bd0b8a665
Author: Tboy <guo.jiwei@immomo.com>
Date:   Fri Sep 25 10:24:08 2020 +0800

    Update doc as jobListener move to JobConfiguration (#1468) (#1489)

diff --git a/docs/content/user-manual/elasticjob-lite/configuration/java-api.cn.md b/docs/content/user-manual/elasticjob-lite/configuration/java-api.cn.md
index 63d7142e3..2bb2478d3 100644
--- a/docs/content/user-manual/elasticjob-lite/configuration/java-api.cn.md
+++ b/docs/content/user-manual/elasticjob-lite/configuration/java-api.cn.md
@@ -44,24 +44,8 @@ chapter = true
 | jobShardingStrategyType       | 否        |
 | jobExecutorServiceHandlerType | 否        |
 | jobErrorHandlerType           | 否        |
+| jobListenerTypes              | 否        |
 | description                   | 否        |
 | props                         | 否        |
 | disabled                      | 否        |
 | overwrite                     | 否        |
-
-## 作业监听器配置
-
-### 常规监听器配置
-
-接口名称：org.apache.shardingsphere.elasticjob.api.listener.ElasticJobListener
-
-可配置属性：无
-
-### 分布式监听器配置
-
-类名称：org.apache.shardingsphere.elasticjob.lite.api.listener.AbstractDistributeOnceElasticJobListener
-
-| 属性名                          | 构造器注入 |
-| ------------------------------ |:--------- |
-| started-timeout-milliseconds   | 是        |
-| completed-timeout-milliseconds | 是        |
diff --git a/docs/content/user-manual/elasticjob-lite/configuration/java-api.en.md b/docs/content/user-manual/elasticjob-lite/configuration/java-api.en.md
index bf1fddfe6..2f025cd5d 100644
--- a/docs/content/user-manual/elasticjob-lite/configuration/java-api.en.md
+++ b/docs/content/user-manual/elasticjob-lite/configuration/java-api.en.md
@@ -44,24 +44,8 @@ Configuration：
 | jobShardingStrategyType       | No                    |
 | jobExecutorServiceHandlerType | No                    |
 | jobErrorHandlerType           | No                    |
+| jobListenerTypes              | No                    |
 | description                   | No                    |
 | props                         | No                    |
 | disabled                      | No                    |
 | overwrite                     | No                    |
-
-## Job Listener Configuration
-
-### Common Listener Configuration
-
-Interface name: `org.apache.shardingsphere.elasticjob.api.listener.ElasticJobListener`
-
-Configuration: no
-
-### Distributed Listener Configuration
-
-Class name: `org.apache.shardingsphere.elasticjob.lite.api.listener.AbstractDistributeOnceElasticJobListener`
-
-| Name                           | Constructor injection |
-| ------------------------------ |:--------------------- |
-| started-timeout-milliseconds   | Yes                   |
-| completed-timeout-milliseconds | Yes                   |
diff --git a/docs/content/user-manual/elasticjob-lite/configuration/spring-boot-starter.cn.md b/docs/content/user-manual/elasticjob-lite/configuration/spring-boot-starter.cn.md
index 419b4d072..7f25c022f 100644
--- a/docs/content/user-manual/elasticjob-lite/configuration/spring-boot-starter.cn.md
+++ b/docs/content/user-manual/elasticjob-lite/configuration/spring-boot-starter.cn.md
@@ -59,6 +59,7 @@ elasticjob.reg-center.server-lists=localhost:6181
 | job-sharding-strategy-type        | 否       |
 | job-executor-service-handler-type | 否       |
 | job-error-handler-type            | 否       |
+| job-listener-types                | 否       |
 | description                       | 否       |
 | props                             | 否       |
 | disabled                          | 否       |
diff --git a/docs/content/user-manual/elasticjob-lite/configuration/spring-boot-starter.en.md b/docs/content/user-manual/elasticjob-lite/configuration/spring-boot-starter.en.md
index 80def1bd8..2852abd64 100644
--- a/docs/content/user-manual/elasticjob-lite/configuration/spring-boot-starter.en.md
+++ b/docs/content/user-manual/elasticjob-lite/configuration/spring-boot-starter.en.md
@@ -59,6 +59,7 @@ Configuration:
 | job-sharding-strategy-type        | No       |
 | job-executor-service-handler-type | No       |
 | job-error-handler-type            | No       |
+| job-listener-types                | No       |
 | description                       | No       |
 | props                             | No       |
 | disabled                          | No       |
diff --git a/docs/content/user-manual/elasticjob-lite/configuration/spring-namespace.cn.md b/docs/content/user-manual/elasticjob-lite/configuration/spring-namespace.cn.md
index cfd313f78..952d9a1c6 100644
--- a/docs/content/user-manual/elasticjob-lite/configuration/spring-namespace.cn.md
+++ b/docs/content/user-manual/elasticjob-lite/configuration/spring-namespace.cn.md
@@ -59,35 +59,12 @@ chapter = true
 | job-sharding-strategy-type        | 否       |
 | job-executor-service-handler-type | 否       |
 | job-error-handler-type            | 否       |
+| job-listener-types                | 否       |
 | description                       | 否       |
 | props                             | 否       |
 | disabled                          | 否       |
 | overwrite                         | 否       |
 
-## 作业监听配置
-
-\<elasticjob:listener />
-
-elasticjob:listener 必须配置为 elasticjob:job 的子元素，并且在子元素中只允许出现一次
-
-可配置属性：
-
-| 属性名  | 类型   | 是否必填 | 缺省值 | 描述                                               |
-| ------ |:------ |:------- |:----- |:-------------------------------------------------- |
-| class  | String | 是      |       | 前置后置任务监听实现类，需实现 ElasticJobListener 接口 |
-
-\<elasticjob:distributed-listener />
-
-elasticjob:distributed-listener 必须配置为 elasticjob:job 的子元素，并且在子元素中只允许出现一次
-
-可配置属性：
-
-| 属性名                          | 类型   | 是否必填 | 缺省值          | 描述                                                                        |
-| ------------------------------ |:------ |:------- |:-------------- |:--------------------------------------------------------------------------- |
-| class                          | String | 是      |                | 前置后置任务分布式监听实现类，需继承 AbstractDistributeOnceElasticJobListener 类 |
-| started-timeout-milliseconds   | long   | 否      | Long.MAX_VALUE | 最后一个作业执行前的执行方法的超时毫秒数                                         |
-| completed-timeout-milliseconds | long   | 否      | Long.MAX_VALUE | 最后一个作业执行后的执行方法的超时毫秒数                                         |
-
 ## 事件追踪配置
 
 \<elasticjob:rdb-event-trace />
diff --git a/docs/content/user-manual/elasticjob-lite/configuration/spring-namespace.en.md b/docs/content/user-manual/elasticjob-lite/configuration/spring-namespace.en.md
index 27ef0e7ed..1bb3f58e0 100644
--- a/docs/content/user-manual/elasticjob-lite/configuration/spring-namespace.en.md
+++ b/docs/content/user-manual/elasticjob-lite/configuration/spring-namespace.en.md
@@ -64,30 +64,6 @@ Configuration：
 | disabled                          | No       |
 | overwrite                         | No       |
 
-## Job Listener Configuration
-
-\<elasticjob:listener />
-
-`elasticjob:listener` must be configured as a child element of `elasticjob:job`, and configure only once in the child element.
-
-Configuration: 
-
-| Name   | Data Type   | Required | Default Value | Description                                                              |
-| ------ |:----------- |:-------- |:------------- |:------------------------------------------------------------------------ |
-| class  | String      | Yes      |               | Common listener class, need to implement `ElasticJobListener` interface  |
-
-\<elasticjob:distributed-listener />
-
-`elasticjob:distributed-listener` must be configured as a child element of `elasticjob:job`, and configure only once in the child element.
-
-Configuration: 
-
-| Name                           | Data Type   | Required | Default Value  | Description                                                                                   |
-| ------------------------------ |:----------- |:-------- |:-------------- |:--------------------------------------------------------------------------------------------- |
-| class                          | String      | Yes      |                | Distributed listener class, need to extend `AbstractDistributeOnceElasticJobListener` class   |
-| started-timeout-milliseconds   | long        | No       | Long.MAX_VALUE | The timeout in milliseconds before the last job is executed                                   |
-| completed-timeout-milliseconds | long        | No       | Long.MAX_VALUE | The timeout in milliseconds after the last job is executed                                    |
-
 ## Event Tracing Configuration
 
 \<elasticjob:rdb-event-trace />
diff --git a/docs/content/user-manual/elasticjob-lite/usage/job-listener/java-api.cn.md b/docs/content/user-manual/elasticjob-lite/usage/job-listener/java-api.cn.md
index 17247e848..af2003e2d 100644
--- a/docs/content/user-manual/elasticjob-lite/usage/job-listener/java-api.cn.md
+++ b/docs/content/user-manual/elasticjob-lite/usage/job-listener/java-api.cn.md
@@ -10,7 +10,7 @@ chapter = true
 public class JobMain {
     
     public static void main(String[] args) {
-        new ScheduleJobBootstrap(createRegistryCenter(), createJobConfiguration(), new MyElasticJobListener()).schedule();
+        new ScheduleJobBootstrap(createRegistryCenter(), createJobConfiguration()).schedule();
     }
     
     private static CoordinatorRegistryCenter createRegistryCenter() {
@@ -20,8 +20,8 @@ public class JobMain {
     }
     
     private static JobConfiguration createJobConfiguration() {
-        // 创建作业配置
-        ...
+        JobConfiguration jobConfiguration = JobConfiguration.newBuilder("test", 2)
+                                .jobListenerTypes("simpleListener", "distributeListener").build();
     }
 }
 ```
@@ -32,9 +32,7 @@ public class JobMain {
 public class JobMain {
     
     public static void main(String[] args) {
-        long startTimeoutMills = 5000L;
-        long completeTimeoutMills = 10000L;
-        new ScheduleJobBootstrap(createRegistryCenter(), createJobConfiguration(), new MyDistributeOnceElasticJobListener(startTimeoutMills, completeTimeoutMills)).schedule();
+        new ScheduleJobBootstrap(createRegistryCenter(), createJobConfiguration()).schedule();
     }
     
     private static CoordinatorRegistryCenter createRegistryCenter() {
@@ -44,8 +42,8 @@ public class JobMain {
     }
     
     private static JobConfiguration createJobConfiguration() {
-        // 创建作业配置
-        ...
+        JobConfiguration jobConfiguration = JobConfiguration.newBuilder("test", 2)
+                        .jobListenerTypes("simpleListener", "distributeListener").build();
     }
 }
 ```
diff --git a/docs/content/user-manual/elasticjob-lite/usage/job-listener/java-api.en.md b/docs/content/user-manual/elasticjob-lite/usage/job-listener/java-api.en.md
index 82cc94b50..22dcfd737 100644
--- a/docs/content/user-manual/elasticjob-lite/usage/job-listener/java-api.en.md
+++ b/docs/content/user-manual/elasticjob-lite/usage/job-listener/java-api.en.md
@@ -10,7 +10,7 @@ chapter = true
 public class JobMain {
     
     public static void main(String[] args) {
-        new ScheduleJobBootstrap(createRegistryCenter(), createJobConfiguration(), new MyElasticJobListener()).schedule();
+        new ScheduleJobBootstrap(createRegistryCenter(), createJobConfiguration()).schedule();
     }
     
     private static CoordinatorRegistryCenter createRegistryCenter() {
@@ -20,8 +20,8 @@ public class JobMain {
     }
     
     private static JobConfiguration createJobConfiguration() {
-        // Create job configuration
-        ...
+        JobConfiguration jobConfiguration = JobConfiguration.newBuilder("test", 2)
+                                        .jobListenerTypes("simpleListener", "distributeListener").build();
     }
 }
 ```
@@ -32,9 +32,7 @@ public class JobMain {
 public class JobMain {
     
     public static void main(String[] args) {
-        long startTimeoutMills = 5000L;
-        long completeTimeoutMills = 10000L;
-        new ScheduleJobBootstrap(createRegistryCenter(), createJobConfiguration(), new MyDistributeOnceElasticJobListener(startTimeoutMills, completeTimeoutMills)).schedule();
+        new ScheduleJobBootstrap(createRegistryCenter(), createJobConfiguration()).schedule();
     }
     
     private static CoordinatorRegistryCenter createRegistryCenter() {
@@ -44,8 +42,8 @@ public class JobMain {
     }
     
     private static JobConfiguration createJobConfiguration() {
-        // Create job configuration
-        ...
+        JobConfiguration jobConfiguration = JobConfiguration.newBuilder("test", 2)
+                                                .jobListenerTypes("simpleListener", "distributeListener").build();
     }
 }
 ```
diff --git a/docs/content/user-manual/elasticjob-lite/usage/job-listener/listener-interface.cn.md b/docs/content/user-manual/elasticjob-lite/usage/job-listener/listener-interface.cn.md
index 1d423fbf7..6f2c637a3 100644
--- a/docs/content/user-manual/elasticjob-lite/usage/job-listener/listener-interface.cn.md
+++ b/docs/content/user-manual/elasticjob-lite/usage/job-listener/listener-interface.cn.md
@@ -22,6 +22,11 @@ public class MyJobListener implements ElasticJobListener {
     public void afterJobExecuted(ShardingContexts shardingContexts) {
         // do something ...
     }
+    
+    @Override
+    public String getType() {
+        return "simpleJobListener";
+    }
 }
 ```
 
@@ -47,5 +52,14 @@ public class MyDistributeOnceJobListener extends AbstractDistributeOnceElasticJo
     public void doAfterJobExecutedAtLastCompleted(ShardingContexts shardingContexts) {
         // do something ...
     }
+    
+    @Override
+    public String getType() {
+        return "distributeOnceJobListener";
+    }
 }
 ```
+
+## 添加SPI实现
+
+将JobListener实现添加至infra-common下resources/META-INF/services/org.apache.shardingsphere.elasticjob.infra.listener.ElasticJobListener
diff --git a/docs/content/user-manual/elasticjob-lite/usage/job-listener/listener-interface.en.md b/docs/content/user-manual/elasticjob-lite/usage/job-listener/listener-interface.en.md
index 2006fa359..4e3ad4252 100644
--- a/docs/content/user-manual/elasticjob-lite/usage/job-listener/listener-interface.en.md
+++ b/docs/content/user-manual/elasticjob-lite/usage/job-listener/listener-interface.en.md
@@ -22,6 +22,11 @@ public class MyJobListener implements ElasticJobListener {
     public void afterJobExecuted(ShardingContexts shardingContexts) {
         // do something ...
     }
+   
+    @Override
+    public String getType() {
+        return "simpleJobListener";
+    }
 }
 ```
 
@@ -47,6 +52,15 @@ public class MyDistributeOnceJobListener extends AbstractDistributeOnceElasticJo
     public void doAfterJobExecutedAtLastCompleted(ShardingContexts shardingContexts) {
         // do something ...
     }
+    
+    @Override
+    public String getType() {
+        return "distributeOnceJobListener";
+    }
 }
 ```
 
+## Add SPI implementation
+
+Put JobListener implementation to module infra-common, resources/META-INF/services/org.apache.shardingsphere.elasticjob.infra.listener.ElasticJobListener
+
diff --git a/docs/content/user-manual/elasticjob-lite/usage/job-listener/spring-namespace.cn.md b/docs/content/user-manual/elasticjob-lite/usage/job-listener/spring-namespace.cn.md
index a43c7984f..466b5d89e 100644
--- a/docs/content/user-manual/elasticjob-lite/usage/job-listener/spring-namespace.cn.md
+++ b/docs/content/user-manual/elasticjob-lite/usage/job-listener/spring-namespace.cn.md
@@ -22,10 +22,7 @@ chapter = true
     <!-- 配置作业 Bean -->
     <bean id="myJob" class="xxx.MyJob" />
     
-    <elasticjob:job id="${myJob.id}" job-ref="myJob" registry-center-ref="regCenter" sharding-total-count="3" cron="0/1 * * * * ?">
-        <!-- 配置作业监听器 -->
-        <elasticjob:listener class="xxx.MyJobListener" />
-        <elasticjob:distributed-listener class="xxx.MyDistributeOnceJobListener" started-timeout-milliseconds="10000" completed-timeout-milliseconds="20000" />
+    <elasticjob:job id="${myJob.id}" job-ref="myJob" registry-center-ref="regCenter" sharding-total-count="3" cron="0/1 * * * * ?" job-listener-types="simpleJobListener,distributeOnceJobListener">
     </elasticjob:job>
 </beans>
 ```
diff --git a/docs/content/user-manual/elasticjob-lite/usage/job-listener/spring-namespace.en.md b/docs/content/user-manual/elasticjob-lite/usage/job-listener/spring-namespace.en.md
index c5f95bdd1..00ac86730 100644
--- a/docs/content/user-manual/elasticjob-lite/usage/job-listener/spring-namespace.en.md
+++ b/docs/content/user-manual/elasticjob-lite/usage/job-listener/spring-namespace.en.md
@@ -22,10 +22,7 @@ chapter = true
     <!-- Configuration Job Bean -->
     <bean id="myJob" class="xxx.MyJob" />
     
-    <elasticjob:job id="${myJob.id}" job-ref="myJob" registry-center-ref="regCenter" sharding-total-count="3" cron="0/1 * * * * ?">
-        <!-- Configure job listener -->
-        <elasticjob:listener class="xxx.MyJobListener" />
-        <elasticjob:distributed-listener class="xxx.MyDistributeOnceJobListener" started-timeout-milliseconds="10000" completed-timeout-milliseconds="20000" />
+    <elasticjob:job id="${myJob.id}" job-ref="myJob" registry-center-ref="regCenter" sharding-total-count="3" cron="0/1 * * * * ?" job-listener-types="simpleJobListener,distributeOnceJobListener">
     </elasticjob:job>
 </beans>
 ```
