This is an automated email from the ASF dual-hosted git repository.

zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere-elasticjob.git


The following commit(s) were added to refs/heads/master by this push:
     new abeb9d2  For #1131 Translate index & listener-interface (#1135)
abeb9d2 is described below

commit abeb9d292d3dedafa505b4b30dae072532ca7720
Author: 于玉桔 <[email protected]>
AuthorDate: Sat Jul 18 17:20:52 2020 +0800

    For #1131 Translate index & listener-interface (#1135)
---
 .../usage/job-listener/_index.en.md                |  6 ++-
 .../usage/job-listener/listener-interface.en.md    | 47 +++++++++++++++++++++-
 2 files changed, 51 insertions(+), 2 deletions(-)

diff --git 
a/docs/content/user-manual/elasticjob-lite/usage/job-listener/_index.en.md 
b/docs/content/user-manual/elasticjob-lite/usage/job-listener/_index.en.md
index 54ddd659..fa5584c 100644
--- a/docs/content/user-manual/elasticjob-lite/usage/job-listener/_index.en.md
+++ b/docs/content/user-manual/elasticjob-lite/usage/job-listener/_index.en.md
@@ -4,4 +4,8 @@ weight = 2
 chapter = true
 +++
 
-TODO
+ElasticJob-Lite provides job listeners, which are used to perform monitoring 
methods before and after task execution.
+Listeners are divided into regular listeners executed by each job node and 
distributed listeners executed by only a single node in a distributed scenario.
+This chapter will introduce how to use them in detail.
+
+After the job dependency (DAG) function is developed, the job listener 
function may be considered to be deleted.
\ No newline at end of file
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 a72ef66..2006fa3 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
@@ -4,4 +4,49 @@ weight = 1
 chapter = true
 +++
 
-TODO
+## Common Listener
+
+If the job processes the files of the job server and deletes the files after 
the processing is completed, consider using each node to perform the cleaning 
task.
+This type of task is simple to implement, and there is no need to consider 
whether the global distributed task is completed. You should try to use this 
type of listener.
+
+```java
+
+public class MyJobListener implements ElasticJobListener {
+    
+    @Override
+    public void beforeJobExecuted(ShardingContexts shardingContexts) {
+        // do something ...
+    }
+    
+    @Override
+    public void afterJobExecuted(ShardingContexts shardingContexts) {
+        // do something ...
+    }
+}
+```
+
+## Distributed Listener
+
+If the job processes database data, only one node needs to complete the data 
cleaning task after the processing is completed.
+This type of task is complicated to process and needs to synchronize the 
status of the job in a distributed environment. Timeout settings are provided 
to avoid deadlocks caused by job out of sync. It should be used with caution.
+
+```java
+
+public class MyDistributeOnceJobListener extends 
AbstractDistributeOnceElasticJobListener {
+    
+    public TestDistributeOnceElasticJobListener(long startTimeoutMills, long 
completeTimeoutMills) {
+        super(startTimeoutMills, completeTimeoutMills);
+    }
+    
+    @Override
+    public void doBeforeJobExecutedAtLastStarted(ShardingContexts 
shardingContexts) {
+        // do something ...
+    }
+    
+    @Override
+    public void doAfterJobExecutedAtLastCompleted(ShardingContexts 
shardingContexts) {
+        // do something ...
+    }
+}
+```
+

Reply via email to