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 3faf4dd Translate
docs/content/user-manual/elasticjob-lite/usage/job-listener/listener-interface.en.md
(#1133)
3faf4dd is described below
commit 3faf4dd1507d843a3d6b03676bf4598e9f12e452
Author: 于玉桔 <[email protected]>
AuthorDate: Sat Jul 18 17:19:22 2020 +0800
Translate
docs/content/user-manual/elasticjob-lite/usage/job-listener/listener-interface.en.md
(#1133)
---
.../usage/job-listener/java-api.en.md | 46 +++++++++++++++++++++-
1 file changed, 45 insertions(+), 1 deletion(-)
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 a9876e7..82cc94b 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
@@ -4,4 +4,48 @@ weight = 2
chapter = true
+++
-TODO
+## Common Listener
+
+```java
+public class JobMain {
+
+ public static void main(String[] args) {
+ new ScheduleJobBootstrap(createRegistryCenter(),
createJobConfiguration(), new MyElasticJobListener()).schedule();
+ }
+
+ private static CoordinatorRegistryCenter createRegistryCenter() {
+ CoordinatorRegistryCenter regCenter = new ZookeeperRegistryCenter(new
ZookeeperConfiguration("zk_host:2181", "elastic-job-demo"));
+ regCenter.init();
+ return regCenter;
+ }
+
+ private static JobConfiguration createJobConfiguration() {
+ // Create job configuration
+ ...
+ }
+}
+```
+
+## Distributed Listener
+
+```java
+public class JobMain {
+
+ public static void main(String[] args) {
+ long startTimeoutMills = 5000L;
+ long completeTimeoutMills = 10000L;
+ new ScheduleJobBootstrap(createRegistryCenter(),
createJobConfiguration(), new
MyDistributeOnceElasticJobListener(startTimeoutMills,
completeTimeoutMills)).schedule();
+ }
+
+ private static CoordinatorRegistryCenter createRegistryCenter() {
+ CoordinatorRegistryCenter regCenter = new ZookeeperRegistryCenter(new
ZookeeperConfiguration("zk_host:2181", "elastic-job-demo"));
+ regCenter.init();
+ return regCenter;
+ }
+
+ private static JobConfiguration createJobConfiguration() {
+ // Create job configuration
+ ...
+ }
+}
+```