You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2020/07/17 18:23:03 UTC

[shardingsphere-elasticjob] branch master updated: Update document of job api (#1112)

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 fd95d09  Update document of job api (#1112)
fd95d09 is described below

commit fd95d0900ea5616b43ba10848b09de74e1e5311c
Author: Liang Zhang <te...@163.com>
AuthorDate: Sat Jul 18 02:22:53 2020 +0800

    Update document of job api (#1112)
    
    * Adjust structure of lite usage
    
    * Update Environment Required
    
    * Update index of job api
    
    * Update job-api document
---
 README.md                                          |  14 ++
 README_ZH.md                                       |  14 ++
 docs/content/overview/_index.cn.md                 |  14 ++
 docs/content/overview/_index.en.md                 |  14 ++
 .../elasticjob-cloud/usage/_index.cn.md            |   3 +-
 .../user-manual/elasticjob-lite/usage/_index.cn.md |   3 +-
 .../_index.cn.md}                                  |   2 +-
 .../_index.en.md}                                  |   0
 .../usage/{ => event-trace}/event-trace.cn.md      |   2 +-
 .../event-trace.en.md}                             |   2 +-
 .../elasticjob-lite/usage/job-api.cn.md            | 218 ---------------------
 .../elasticjob-lite/usage/job-api/_index.cn.md     |   8 +
 .../elasticjob-lite/usage/job-api/_index.en.md     |   8 +
 .../elasticjob-lite/usage/job-api/java-api.cn.md   |  70 +++++++
 .../{job-listener.en.md => job-api/java-api.en.md} |   2 +-
 .../usage/job-api/job-interface.cn.md              | 105 ++++++++++
 .../{job-api.en.md => job-api/job-interface.en.md} |   2 +-
 .../usage/job-api/spring-boot-starter.cn.md        |  18 ++
 .../spring-boot-starter.en.md}                     |   4 +-
 .../usage/job-api/spring-namespace.cn.md           |  44 +++++
 .../spring-namespace.en.md}                        |   2 +-
 .../_index.cn.md}                                  |   2 +-
 .../_index.en.md}                                  |   0
 .../usage/{ => job-listener}/job-listener.cn.md    |   2 +-
 .../usage/{ => job-listener}/job-listener.en.md    |   2 +-
 .../_index.cn.md}                                  |   2 +-
 .../_index.en.md}                                  |   0
 .../usage/{ => operation-api}/operation-api.cn.md  |   2 +-
 .../usage/{ => operation-api}/operation-api.en.md  |   2 +-
 29 files changed, 326 insertions(+), 235 deletions(-)

diff --git a/README.md b/README.md
index a1a2d7e..5c43db4 100644
--- a/README.md
+++ b/README.md
@@ -78,3 +78,17 @@ Uses Mesos to manage and isolate resources.
   - Job administration
   - Job event trace query
   - Registry center management
+
+## Environment Required
+
+### Java
+
+Java 8 or above required.
+
+### ZooKeeper
+
+Zookeeper or above required. [See details](https://zookeeper.apache.org/)
+
+### Mesos (ElasticJob-Cloud only)
+
+Mesos 1.1.0 or compatible version required (For ElasticJob-Cloud only). [See details](https://mesos.apache.org/)
diff --git a/README_ZH.md b/README_ZH.md
index f5f481a..57f049f 100644
--- a/README_ZH.md
+++ b/README_ZH.md
@@ -73,3 +73,17 @@ ElasticJob 已于 2020 年 5 月 28 日成为 [Apache ShardingSphere](https://sh
   - 作业管控端
   - 作业执行历史数据追踪
   - 注册中心管理
+
+## 环境要求
+
+### Java
+
+请使用 Java 8 及其以上版本。
+
+### ZooKeeper
+
+请使用 Zookeeper 3.6.0 及其以上版本。[详情参见](https://zookeeper.apache.org/)
+
+### Mesos(仅 ElasticJob-Cloud 使用)
+
+请使用 Mesos 1.1.0 及其兼容版本。[详情参见](https://mesos.apache.org/)
diff --git a/docs/content/overview/_index.cn.md b/docs/content/overview/_index.cn.md
index da21aea..432e6a9 100644
--- a/docs/content/overview/_index.cn.md
+++ b/docs/content/overview/_index.cn.md
@@ -80,3 +80,17 @@ ElasticJob 已于 2020 年 5 月 28 日成为 [Apache ShardingSphere](https://sh
   - 作业管控端
   - 作业执行历史数据追踪
   - 注册中心管理
+
+## 环境要求
+
+### Java
+
+请使用 Java 8 及其以上版本。
+
+### ZooKeeper
+
+请使用 Zookeeper 3.6.0 及其以上版本。[详情参见](https://zookeeper.apache.org/)
+
+### Mesos(仅 ElasticJob-Cloud 使用)
+
+请使用 Mesos 1.1.0 及其兼容版本。[详情参见](https://mesos.apache.org/)
diff --git a/docs/content/overview/_index.en.md b/docs/content/overview/_index.en.md
index c646e0f..b7e1012 100644
--- a/docs/content/overview/_index.en.md
+++ b/docs/content/overview/_index.en.md
@@ -85,3 +85,17 @@ Uses Mesos to manage and isolate resources.
   - Job administration
   - Job event trace query
   - Registry center management
+
+## Environment Required
+
+### Java
+
+Java 8 or above required.
+
+### ZooKeeper
+
+Zookeeper or above required. [See details](https://zookeeper.apache.org/)
+
+### Mesos (ElasticJob-Cloud only)
+
+Mesos 1.1.0 or compatible version required. [See details](https://mesos.apache.org/)
\ No newline at end of file
diff --git a/docs/content/user-manual/elasticjob-cloud/usage/_index.cn.md b/docs/content/user-manual/elasticjob-cloud/usage/_index.cn.md
index 0f17fa4..d48c087 100644
--- a/docs/content/user-manual/elasticjob-cloud/usage/_index.cn.md
+++ b/docs/content/user-manual/elasticjob-cloud/usage/_index.cn.md
@@ -5,4 +5,5 @@ weight = 1
 chapter = true
 +++
 
-本章节将介绍 ElasticJob-Cloud 相关使用。 更多使用细节请参见[使用示例](https://github.com/apache/shardingsphere-elasticjob/tree/master/examples)。
+本章节将介绍 ElasticJob-Cloud 相关使用。
+更多使用细节请参见[使用示例](https://github.com/apache/shardingsphere-elasticjob/tree/master/examples)。
diff --git a/docs/content/user-manual/elasticjob-lite/usage/_index.cn.md b/docs/content/user-manual/elasticjob-lite/usage/_index.cn.md
index 93d9bd3..6e2dd56 100644
--- a/docs/content/user-manual/elasticjob-lite/usage/_index.cn.md
+++ b/docs/content/user-manual/elasticjob-lite/usage/_index.cn.md
@@ -5,4 +5,5 @@ weight = 1
 chapter = true
 +++
 
-本章节将介绍 ElasticJob-Lite 相关使用。 更多使用细节请参见[使用示例](https://github.com/apache/shardingsphere-elasticjob/tree/master/examples)。
+本章节将介绍 ElasticJob-Lite 相关使用。
+更多使用细节请参见[使用示例](https://github.com/apache/shardingsphere-elasticjob/tree/master/examples)。
diff --git a/docs/content/user-manual/elasticjob-lite/usage/event-trace.en.md b/docs/content/user-manual/elasticjob-lite/usage/event-trace/_index.cn.md
similarity index 63%
copy from docs/content/user-manual/elasticjob-lite/usage/event-trace.en.md
copy to docs/content/user-manual/elasticjob-lite/usage/event-trace/_index.cn.md
index a91690b..3396a26 100644
--- a/docs/content/user-manual/elasticjob-lite/usage/event-trace.en.md
+++ b/docs/content/user-manual/elasticjob-lite/usage/event-trace/_index.cn.md
@@ -1,5 +1,5 @@
 +++
-title = "Event Trace"
+title = "事件追踪"
 weight = 3
 chapter = true
 +++
diff --git a/docs/content/user-manual/elasticjob-lite/usage/event-trace.en.md b/docs/content/user-manual/elasticjob-lite/usage/event-trace/_index.en.md
similarity index 100%
copy from docs/content/user-manual/elasticjob-lite/usage/event-trace.en.md
copy to docs/content/user-manual/elasticjob-lite/usage/event-trace/_index.en.md
diff --git a/docs/content/user-manual/elasticjob-lite/usage/event-trace.cn.md b/docs/content/user-manual/elasticjob-lite/usage/event-trace/event-trace.cn.md
similarity index 99%
rename from docs/content/user-manual/elasticjob-lite/usage/event-trace.cn.md
rename to docs/content/user-manual/elasticjob-lite/usage/event-trace/event-trace.cn.md
index 5c50e62..16243d8 100644
--- a/docs/content/user-manual/elasticjob-lite/usage/event-trace.cn.md
+++ b/docs/content/user-manual/elasticjob-lite/usage/event-trace/event-trace.cn.md
@@ -1,6 +1,6 @@
 +++
 title = "事件追踪"
-weight = 3
+weight = 1
 chapter = true
 +++
 
diff --git a/docs/content/user-manual/elasticjob-lite/usage/job-api.en.md b/docs/content/user-manual/elasticjob-lite/usage/event-trace/event-trace.en.md
similarity index 64%
copy from docs/content/user-manual/elasticjob-lite/usage/job-api.en.md
copy to docs/content/user-manual/elasticjob-lite/usage/event-trace/event-trace.en.md
index e28dabe..0d6c198 100644
--- a/docs/content/user-manual/elasticjob-lite/usage/job-api.en.md
+++ b/docs/content/user-manual/elasticjob-lite/usage/event-trace/event-trace.en.md
@@ -1,5 +1,5 @@
 +++
-title = "Job API"
+title = "Event Trace"
 weight = 1
 chapter = true
 +++
diff --git a/docs/content/user-manual/elasticjob-lite/usage/job-api.cn.md b/docs/content/user-manual/elasticjob-lite/usage/job-api.cn.md
deleted file mode 100644
index 558d276..0000000
--- a/docs/content/user-manual/elasticjob-lite/usage/job-api.cn.md
+++ /dev/null
@@ -1,218 +0,0 @@
-+++
-title = "作业 API"
-weight = 1
-chapter = true
-+++
-
-## 0. 环境要求
-
-### a. Java
-
-请使用 Java 8 及其以上版本。
-
-### b. Zookeeper
-
-请使用 Zookeeper 3.6.0 及其以上版本。[详情参见](https://zookeeper.apache.org/)
-
-### c. Maven
-
-请使用 Maven 3.0.4 及其以上版本。[详情参见](http://maven.apache.org/install.html)
-
-## 1. 作业开发
-
-ElasticJob-Lite 和 ElasticJob-Cloud 提供统一作业接口,开发者仅需对业务作业进行一次开发,之后可根据不同的配置以及部署至不同的 Lite 或 Cloud 环境。
-
-ElasticJob 提供 Simple、Dataflow 和 Script 3 种作业类型。
-方法参数shardingContext包含作业配置、片和运行时信息。可通过getShardingTotalCount(), getShardingItem()等方法分别获取分片总数,运行在本作业服务器的分片序列号等。
-
-### a. Simple类型作业
-
-意为简单实现,未经任何封装的类型。需实现SimpleJob接口。该接口仅提供单一方法用于覆盖,此方法将定时执行。与Quartz原生接口相似,但提供了弹性扩缩容和分片等功能。
-
-```java
-public class MyElasticJob implements SimpleJob {
-    
-    @Override
-    public void execute(ShardingContext context) {
-        switch (context.getShardingItem()) {
-            case 0: 
-                // do something by sharding item 0
-                break;
-            case 1: 
-                // do something by sharding item 1
-                break;
-            case 2: 
-                // do something by sharding item 2
-                break;
-            // case n: ...
-        }
-    }
-}
-```
-
-### b. Dataflow类型作业
-
-Dataflow类型用于处理数据流,需实现DataflowJob接口。该接口提供2个方法可供覆盖,分别用于抓取(fetchData)和处理(processData)数据。
-
-```java
-public class MyElasticJob implements DataflowJob<Foo> {
-    
-    @Override
-    public List<Foo> fetchData(ShardingContext context) {
-        switch (context.getShardingItem()) {
-            case 0: 
-                List<Foo> data = // get data from database by sharding item 0
-                return data;
-            case 1: 
-                List<Foo> data = // get data from database by sharding item 1
-                return data;
-            case 2: 
-                List<Foo> data = // get data from database by sharding item 2
-                return data;
-            // case n: ...
-        }
-    }
-    
-    @Override
-    public void processData(ShardingContext shardingContext, List<Foo> data) {
-        // process data
-        // ...
-    }
-}
-```
-
-***
-
-**流式处理**
-
-可通过DataflowJobConfiguration配置是否流式处理。
-
-流式处理数据只有fetchData方法的返回值为null或集合长度为空时,作业才停止抓取,否则作业将一直运行下去;
-非流式处理数据则只会在每次作业执行过程中执行一次fetchData方法和processData方法,随即完成本次作业。
-
-如果采用流式作业处理方式,建议processData处理数据后更新其状态,避免fetchData再次抓取到,从而使得作业永不停止。
-流式数据处理参照TbSchedule设计,适用于不间歇的数据处理。
-
-### c. Script类型作业
-
-Script类型作业意为脚本类型作业,支持shell,python,perl等所有类型脚本。只需通过控制台或代码配置scriptCommandLine即可,无需编码。执行脚本路径可包含参数,参数传递完毕后,作业框架会自动追加最后一个参数为作业运行时信息。
-
-```
-#!/bin/bash
-echo sharding execution context is $*
-```
-
-作业运行时输出
-
-sharding execution context is {"jobName":"scriptElasticDemoJob","shardingTotalCount":10,"jobParameter":"","shardingItem":0,"shardingParameter":"A"}
-
-## 2. 作业配置
-
-ElasticJob 配置分为3个层级,分别是Core, Type和Root。每个层级使用相似于装饰者模式的方式装配。
-
-Core 对应 JobCoreConfiguration,用于提供作业核心配置信息,如:作业名称、分片总数、CRON表达式等。
-
-Type 对应 JobTypeConfiguration,有3个子类分别对应SIMPLE, DATAFLOW和SCRIPT类型作业,提供3种作业需要的不同配置,如:DATAFLOW类型是否流式处理或SCRIPT类型的命令行等。
-
-Root 对应 JobConfiguration,有2个子类分别对应Lite和Cloud部署类型,提供不同部署类型所需的配置,如:Lite类型的是否需要覆盖本地配置或Cloud占用CPU或Memory数量等。
-
-### a. 使用Java代码配置
-
-**通用作业配置**
-
-```java
-    // 定义作业核心配置
-    JobCoreConfiguration simpleCoreConfig = JobCoreConfiguration.newBuilder("demoSimpleJob", "0/15 * * * * ?", 10).build();
-    // 定义 SIMPLE 类型配置
-    SimpleJobConfiguration simpleJobConfig = new SimpleJobConfiguration(simpleCoreConfig, SimpleDemoJob.class.getCanonicalName());
-    // 定义作业根配置
-    JobConfiguration simpleJJobRootConfig = JobConfiguration.newBuilder(simpleJobConfig).build();
-    
-    // 定义作业核心配置
-    JobCoreConfiguration dataflowCoreConfig = JobCoreConfiguration.newBuilder("demoDataflowJob", "0/30 * * * * ?", 10).build();
-    // 定义 DATAFLOW 类型配置
-    DataflowJobConfiguration dataflowJobConfig = new DataflowJobConfiguration(dataflowCoreConfig, DataflowDemoJob.class.getCanonicalName(), true);
-    // 定义Lite作业根配置
-    JobConfiguration dataflowJobRootConfig = JobConfiguration.newBuilder(dataflowJobConfig).build();
-    
-    // 定义作业核心配置配置
-    JobCoreConfiguration scriptCoreConfig = JobCoreConfiguration.newBuilder("demoScriptJob", "0/45 * * * * ?", 10).build();
-    // 定义 SCRIPT 类型配置
-    ScriptJobConfiguration scriptJobConfig = new ScriptJobConfiguration(scriptCoreConfig, "test.sh");
-    // 定义作业根配置
-    JobConfiguration scriptJobRootConfig = JobConfiguration.newBuilder(scriptCoreConfig).build();
-```
-
-### b. Spring命名空间配置
-
-与Spring容器配合使用作业,可将作业Bean配置为Spring Bean,并在作业中通过依赖注入使用Spring容器管理的数据源等对象。可用placeholder占位符从属性文件中取值。Lite可考虑使用Spring命名空间方式简化配置。
-
-```xml
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xmlns:elasticjob="http://shardingsphere.apache.org/schema/elasticjob"
-    xsi:schemaLocation="http://www.springframework.org/schema/beans 
-                        http://www.springframework.org/schema/beans/spring-beans.xsd 
-                        http://shardingsphere.apache.org/schema/elasticjob
-                        http://shardingsphere.apache.org/schema/elasticjob/elasticjob.xsd
-                        ">
-    <!--配置作业注册中心 -->
-    <elasticjob:zookeeper id="regCenter" server-lists="yourhost:2181" namespace="dd-job" base-sleep-time-milliseconds="1000" max-sleep-time-milliseconds="3000" max-retries="3" />
-    
-    <!-- 配置简单作业-->
-    <elasticjob:job id="simpleElasticJob" class="xxx.MySimpleElasticJob" registry-center-ref="regCenter" cron="0/10 * * * * ?" sharding-total-count="3" sharding-item-parameters="0=A,1=B,2=C" />
-    
-    <bean id="yourRefJobBeanId" class="xxx.MySimpleRefElasticJob">
-        <property name="fooService" ref="xxx.FooService"/>
-    </bean>
-    
-    <!-- 配置关联Bean作业-->
-    <elasticjob:job id="simpleRefElasticJob" job-ref="yourRefJobBeanId" registry-center-ref="regCenter" cron="0/10 * * * * ?" sharding-total-count="3" sharding-item-parameters="0=A,1=B,2=C" />
-    
-    <!-- 配置数据流作业-->
-    <elasticjob:job id="throughputDataflow" class="xxx.MyThroughputDataflowElasticJob" registry-center-ref="regCenter" cron="0/10 * * * * ?" sharding-total-count="3" sharding-item-parameters="0=A,1=B,2=C" />
-    
-    <!-- 配置脚本作业-->
-    <elasticjob:job id="scriptElasticJob" registry-center-ref="regCenter" cron="0/10 * * * * ?" sharding-total-count="3" sharding-item-parameters="0=A,1=B,2=C" script-command-line="/your/file/path/demo.sh" />
-    
-    <!-- 配置带监听的简单作业-->
-    <elasticjob:job id="listenerElasticJob" class="xxx.MySimpleListenerElasticJob" registry-center-ref="regCenter" cron="0/10 * * * * ?" sharding-total-count="3" sharding-item-parameters="0=A,1=B,2=C">
-        <elasticjob:listener class="xx.MySimpleJobListener"/>
-        <elasticjob:distributed-listener class="xx.MyOnceSimpleJobListener" started-timeout-milliseconds="1000" completed-timeout-milliseconds="2000" />
-    </elasticjob:job>
-    
-    <!-- 配置带作业数据库事件追踪的简单作业-->
-    <elasticjob:job id="eventTraceElasticJob" class="xxx.MySimpleListenerElasticJob" registry-center-ref="regCenter" tracing-ref="yourDataSource" cron="0/10 * * * * ?" sharding-total-count="3" sharding-item-parameters="0=A,1=B,2=C" />
-</beans>
-```
-
-配置项详细说明请参见[配置手册](/02-guide/config-manual)
-
-## 3. 作业启动
-
-### a. Java 启动方式
-
-```java
-public class JobDemo {
-    
-    public static void main(String[] args) {
-        new JobScheduler(createRegistryCenter(), createJobConfiguration()).init();
-    }
-    
-    private static CoordinatorRegistryCenter createRegistryCenter() {
-        CoordinatorRegistryCenter regCenter = new ZookeeperRegistryCenter(new ZookeeperConfiguration("zk_host:2181", "elastic-job-demo"));
-        regCenter.init();
-        return regCenter;
-    }
-    
-    private static JobConfiguration createJobConfiguration() {
-        // 创建作业配置
-        ...
-    }
-}
-```
-
-### b. Spring 启动方式
-
-将配置 Spring 命名空间的 xml 通过 Spring 启动,作业将自动加载。
diff --git a/docs/content/user-manual/elasticjob-lite/usage/job-api/_index.cn.md b/docs/content/user-manual/elasticjob-lite/usage/job-api/_index.cn.md
new file mode 100644
index 0000000..405f2fd
--- /dev/null
+++ b/docs/content/user-manual/elasticjob-lite/usage/job-api/_index.cn.md
@@ -0,0 +1,8 @@
++++
+title = "作业 API"
+weight = 1
+chapter = true
++++
+
+ElasticJob-Lite 支持原生 Java、Spring Boot Starter 和 Spring 自定义命名空间 3 种使用方式。
+本章节将详细介绍他们的使用方式。
diff --git a/docs/content/user-manual/elasticjob-lite/usage/job-api/_index.en.md b/docs/content/user-manual/elasticjob-lite/usage/job-api/_index.en.md
new file mode 100644
index 0000000..2731af7
--- /dev/null
+++ b/docs/content/user-manual/elasticjob-lite/usage/job-api/_index.en.md
@@ -0,0 +1,8 @@
++++
+title = "Job API"
+weight = 1
+chapter = true
++++
+
+ElasticJob-Lite can use for native Java, Spring Boot Starter and Spring namespace.
+This chapter will introduce how to use them.
diff --git a/docs/content/user-manual/elasticjob-lite/usage/job-api/java-api.cn.md b/docs/content/user-manual/elasticjob-lite/usage/job-api/java-api.cn.md
new file mode 100644
index 0000000..38434b4
--- /dev/null
+++ b/docs/content/user-manual/elasticjob-lite/usage/job-api/java-api.cn.md
@@ -0,0 +1,70 @@
++++
+title = "使用 Java API"
+weight = 2
+chapter = true
++++
+
+## 作业配置
+
+ElasticJob-Lite 采用构建器模式创建作业配置对象。
+代码示例如下:
+
+```java
+    JobConfiguration jobConfig = JobConfiguration.newBuilder("myJob", 3).cron("0/5 * * * * ?").shardingItemParameters("0=Beijing,1=Shanghai,2=Guangzhou").build();
+```
+
+## 作业启动
+
+ElasticJob-Lite 调度器分为定时调度和一次性调度两种类型。
+每种调度器启动时均需要注册中心配置、作业对象(或作业类型)以及作业配置这 3 个参数。
+
+### 定时调度
+
+```java
+public class JobDemo {
+    
+    public static void main(String[] args) {
+        // 调度基于 class 类型的作业
+        new ScheduleJobBootstrap(createRegistryCenter(), new MyJob(), createJobConfiguration()).schedule();
+        // 调度基于 type 类型的作业
+        new ScheduleJobBootstrap(createRegistryCenter(), "MY_TYPE", createJobConfiguration()).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() {
+        // 创建作业配置
+        ...
+    }
+}
+```
+
+### 一次性调度
+
+```java
+public class JobDemo {
+    
+    public static void main(String[] args) {
+        OneOffJobBootstrap jobBootstrap = new OneOffJobBootstrap(createRegistryCenter(), new MyJob(), createJobConfiguration());
+        // 可多次调用一次性调度
+        jobBootstrap.execute();
+        jobBootstrap.execute();
+        jobBootstrap.execute();
+    }
+    
+    private static CoordinatorRegistryCenter createRegistryCenter() {
+        CoordinatorRegistryCenter regCenter = new ZookeeperRegistryCenter(new ZookeeperConfiguration("zk_host:2181", "elastic-job-demo"));
+        regCenter.init();
+        return regCenter;
+    }
+    
+    private static JobConfiguration createJobConfiguration() {
+        // 创建作业配置
+        ...
+    }
+}
+```
diff --git a/docs/content/user-manual/elasticjob-lite/usage/job-listener.en.md b/docs/content/user-manual/elasticjob-lite/usage/job-api/java-api.en.md
similarity index 63%
copy from docs/content/user-manual/elasticjob-lite/usage/job-listener.en.md
copy to docs/content/user-manual/elasticjob-lite/usage/job-api/java-api.en.md
index 54ddd659..a9876e7 100644
--- a/docs/content/user-manual/elasticjob-lite/usage/job-listener.en.md
+++ b/docs/content/user-manual/elasticjob-lite/usage/job-api/java-api.en.md
@@ -1,5 +1,5 @@
 +++
-title = "Job Listener"
+title = "Use Java API"
 weight = 2
 chapter = true
 +++
diff --git a/docs/content/user-manual/elasticjob-lite/usage/job-api/job-interface.cn.md b/docs/content/user-manual/elasticjob-lite/usage/job-api/job-interface.cn.md
new file mode 100644
index 0000000..793a355
--- /dev/null
+++ b/docs/content/user-manual/elasticjob-lite/usage/job-api/job-interface.cn.md
@@ -0,0 +1,105 @@
++++
+title = "作业开发"
+weight = 1
+chapter = true
++++
+
+ElasticJob-Lite 和 ElasticJob-Cloud 提供统一作业接口,开发者仅需对业务作业进行一次开发,之后可根据不同的配置以及部署至不同环境。
+
+ElasticJob 的作业分类基于 class 和 type 两种类型。
+基于 class 的作业需要开发者自行通过实现接口的方式织入业务逻辑;
+基于 type 的作业则无需编码,只需要提供相应配置即可。
+
+基于 class 的作业接口的方法参数 `shardingContext` 包含作业配置、片和运行时信息。
+可通过 `getShardingTotalCount()`, `getShardingItem()` 等方法分别获取分片总数,运行在本作业服务器的分片序列号等。
+
+ElasticJob 目前提供 Simple、Dataflow 这两种基于 class 的作业类型,并提供 Script 这一种基于 type 的作业类型,用户可通过实现 SPI 接口自行扩展作业类型。
+
+## 简单作业
+
+意为简单实现,未经任何封装的类型。需实现 SimpleJob 接口。
+该接口仅提供单一方法用于覆盖,此方法将定时执行。
+与Quartz原生接口相似,但提供了弹性扩缩容和分片等功能。
+
+```java
+public class MyElasticJob implements SimpleJob {
+    
+    @Override
+    public void execute(ShardingContext context) {
+        switch (context.getShardingItem()) {
+            case 0: 
+                // do something by sharding item 0
+                break;
+            case 1: 
+                // do something by sharding item 1
+                break;
+            case 2: 
+                // do something by sharding item 2
+                break;
+            // case n: ...
+        }
+    }
+}
+```
+
+## 数据流作业
+
+用于处理数据流,需实现 DataflowJob 接口。
+该接口提供2个方法可供覆盖,分别用于抓取 (fetchData) 和处理 (processData) 数据。
+
+```java
+public class MyElasticJob implements DataflowJob<Foo> {
+    
+    @Override
+    public List<Foo> fetchData(ShardingContext context) {
+        switch (context.getShardingItem()) {
+            case 0: 
+                List<Foo> data = // get data from database by sharding item 0
+                return data;
+            case 1: 
+                List<Foo> data = // get data from database by sharding item 1
+                return data;
+            case 2: 
+                List<Foo> data = // get data from database by sharding item 2
+                return data;
+            // case n: ...
+        }
+    }
+    
+    @Override
+    public void processData(ShardingContext shardingContext, List<Foo> data) {
+        // process data
+        // ...
+    }
+}
+```
+
+***
+
+**流式处理**
+
+可通过属性配置 `streaming.process` 开启或关闭流式处理。
+
+如果开启流式处理,则作业只有在 fetchData 方法的返回值为 null 或集合容量为空时,才停止抓取,否则作业将一直运行下去;
+如果关闭流式处理,则作业只会在每次作业执行过程中执行一次 fetchData 和 processData 方法,随即完成本次作业。
+
+如果采用流式作业处理方式,建议 processData 在处理数据后更新其状态,避免 fetchData 再次抓取到,从而使得作业永不停止。
+
+## 脚本作业
+
+支持 shell,python,perl 等所有类型脚本。
+可通过属性配置 `script.command.line` 配置待执行脚本,无需编码。
+执行脚本路径可包含参数,参数传递完毕后,作业框架会自动追加最后一个参数为作业运行时信息。
+
+例如如下脚本:
+
+```bash
+#!/bin/bash
+echo sharding execution context is $*
+```
+
+作业运行时将输出:
+
+```
+sharding execution context is {"jobName":"scriptElasticDemoJob","shardingTotalCount":10,"jobParameter":"","shardingItem":0,"shardingParameter":"A"}
+```
diff --git a/docs/content/user-manual/elasticjob-lite/usage/job-api.en.md b/docs/content/user-manual/elasticjob-lite/usage/job-api/job-interface.en.md
similarity index 60%
rename from docs/content/user-manual/elasticjob-lite/usage/job-api.en.md
rename to docs/content/user-manual/elasticjob-lite/usage/job-api/job-interface.en.md
index e28dabe..41d1143 100644
--- a/docs/content/user-manual/elasticjob-lite/usage/job-api.en.md
+++ b/docs/content/user-manual/elasticjob-lite/usage/job-api/job-interface.en.md
@@ -1,5 +1,5 @@
 +++
-title = "Job API"
+title = "Job Development"
 weight = 1
 chapter = true
 +++
diff --git a/docs/content/user-manual/elasticjob-lite/usage/job-api/spring-boot-starter.cn.md b/docs/content/user-manual/elasticjob-lite/usage/job-api/spring-boot-starter.cn.md
new file mode 100644
index 0000000..8f2525d
--- /dev/null
+++ b/docs/content/user-manual/elasticjob-lite/usage/job-api/spring-boot-starter.cn.md
@@ -0,0 +1,18 @@
++++
+title = "Spring Boot Starter"
+weight = 3
+chapter = true
++++
+
+ElasticJob-Lite 提供自定义的 Spring Boot Starter,可以与 Spring Boot 配合使用。
+开发者能够便捷的在作业中通过依赖注入使用 Spring 容器管理的数据源等对象,并使用占位符从属性文件中取值。
+
+## 作业配置
+
+```yaml
+
+```
+
+## 作业启动
+
+直接启动 Spring Boot Starter 即可。
diff --git a/docs/content/user-manual/elasticjob-lite/usage/event-trace.en.md b/docs/content/user-manual/elasticjob-lite/usage/job-api/spring-boot-starter.en.md
similarity index 53%
rename from docs/content/user-manual/elasticjob-lite/usage/event-trace.en.md
rename to docs/content/user-manual/elasticjob-lite/usage/job-api/spring-boot-starter.en.md
index a91690b..a4484e9 100644
--- a/docs/content/user-manual/elasticjob-lite/usage/event-trace.en.md
+++ b/docs/content/user-manual/elasticjob-lite/usage/job-api/spring-boot-starter.en.md
@@ -1,7 +1,5 @@
 +++
-title = "Event Trace"
+title = "Spring Boot Starter"
 weight = 3
 chapter = true
 +++
-
-TODO
diff --git a/docs/content/user-manual/elasticjob-lite/usage/job-api/spring-namespace.cn.md b/docs/content/user-manual/elasticjob-lite/usage/job-api/spring-namespace.cn.md
new file mode 100644
index 0000000..1ebbef7
--- /dev/null
+++ b/docs/content/user-manual/elasticjob-lite/usage/job-api/spring-namespace.cn.md
@@ -0,0 +1,44 @@
++++
+title = "Spring 命名空间"
+weight = 4
+chapter = true
++++
+
+ElasticJob-Lite 提供自定义的 Spring 命名空间,可以与 Spring 容器配合使用。
+开发者能够便捷的在作业中通过依赖注入使用 Spring 容器管理的数据源等对象,并使用占位符从属性文件中取值。
+
+## 作业配置
+
+```xml
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:elasticjob="http://shardingsphere.apache.org/schema/elasticjob"
+    xsi:schemaLocation="http://www.springframework.org/schema/beans 
+                        http://www.springframework.org/schema/beans/spring-beans.xsd 
+                        http://shardingsphere.apache.org/schema/elasticjob
+                        http://shardingsphere.apache.org/schema/elasticjob/elasticjob.xsd
+                        ">
+    <!--配置作业注册中心 -->
+    <elasticjob:zookeeper id="regCenter" server-lists="yourhost:2181" namespace="dd-job" base-sleep-time-milliseconds="1000" max-sleep-time-milliseconds="3000" max-retries="3" />
+    
+    <!-- 配置作业 Bean-->
+    <bean id="myJob" class="xxx.MyJob">
+        <property name="fooService" ref="xxx.FooService" />
+    </bean>
+    
+    <!-- 配置基于 class 的作业调度-->   
+    <elasticjob:job id="${myJob.id}" job-ref="myJob" registry-center-ref="regCenter" sharding-total-count="${myJob.shardingTotalCount}" cron="${myJob.cron}" />
+    
+    <!-- 配置基于 type 的作业调度-->   
+    <elasticjob:job id="${myScriptJob.id}" job-type="SCRIPT" registry-center-ref="regCenter" sharding-total-count="${myScriptJob.shardingTotalCount}" cron="${myScriptJob.cron}">
+        <props>
+            <prop key="script.command.line">${myScriptJob.scriptCommandLine}</prop>
+        </props>
+    </elasticjob:job>
+</beans>
+```
+
+## 作业启动
+
+将配置 Spring 命名空间的 xml 通过 Spring 启动,作业将自动加载。
diff --git a/docs/content/user-manual/elasticjob-lite/usage/operation-api.en.md b/docs/content/user-manual/elasticjob-lite/usage/job-api/spring-namespace.en.md
similarity index 59%
copy from docs/content/user-manual/elasticjob-lite/usage/operation-api.en.md
copy to docs/content/user-manual/elasticjob-lite/usage/job-api/spring-namespace.en.md
index 5275a98..6046e87 100644
--- a/docs/content/user-manual/elasticjob-lite/usage/operation-api.en.md
+++ b/docs/content/user-manual/elasticjob-lite/usage/job-api/spring-namespace.en.md
@@ -1,5 +1,5 @@
 +++
-title = "Operation API"
+title = "Spring Namespace"
 weight = 4
 chapter = true
 +++
diff --git a/docs/content/user-manual/elasticjob-lite/usage/job-listener.en.md b/docs/content/user-manual/elasticjob-lite/usage/job-listener/_index.cn.md
similarity index 60%
copy from docs/content/user-manual/elasticjob-lite/usage/job-listener.en.md
copy to docs/content/user-manual/elasticjob-lite/usage/job-listener/_index.cn.md
index 54ddd659..d563e63 100644
--- a/docs/content/user-manual/elasticjob-lite/usage/job-listener.en.md
+++ b/docs/content/user-manual/elasticjob-lite/usage/job-listener/_index.cn.md
@@ -1,5 +1,5 @@
 +++
-title = "Job Listener"
+title = "作业监听器"
 weight = 2
 chapter = true
 +++
diff --git a/docs/content/user-manual/elasticjob-lite/usage/job-listener.en.md b/docs/content/user-manual/elasticjob-lite/usage/job-listener/_index.en.md
similarity index 100%
copy from docs/content/user-manual/elasticjob-lite/usage/job-listener.en.md
copy to docs/content/user-manual/elasticjob-lite/usage/job-listener/_index.en.md
diff --git a/docs/content/user-manual/elasticjob-lite/usage/job-listener.cn.md b/docs/content/user-manual/elasticjob-lite/usage/job-listener/job-listener.cn.md
similarity index 99%
rename from docs/content/user-manual/elasticjob-lite/usage/job-listener.cn.md
rename to docs/content/user-manual/elasticjob-lite/usage/job-listener/job-listener.cn.md
index b759d1b..1f287f5 100644
--- a/docs/content/user-manual/elasticjob-lite/usage/job-listener.cn.md
+++ b/docs/content/user-manual/elasticjob-lite/usage/job-listener/job-listener.cn.md
@@ -1,6 +1,6 @@
 +++
 title = "作业监听器"
-weight = 2
+weight = 1
 chapter = true
 +++
 
diff --git a/docs/content/user-manual/elasticjob-lite/usage/job-listener.en.md b/docs/content/user-manual/elasticjob-lite/usage/job-listener/job-listener.en.md
similarity index 82%
rename from docs/content/user-manual/elasticjob-lite/usage/job-listener.en.md
rename to docs/content/user-manual/elasticjob-lite/usage/job-listener/job-listener.en.md
index 54ddd659..ef373a9 100644
--- a/docs/content/user-manual/elasticjob-lite/usage/job-listener.en.md
+++ b/docs/content/user-manual/elasticjob-lite/usage/job-listener/job-listener.en.md
@@ -1,6 +1,6 @@
 +++
 title = "Job Listener"
-weight = 2
+weight = 1
 chapter = true
 +++
 
diff --git a/docs/content/user-manual/elasticjob-lite/usage/operation-api.en.md b/docs/content/user-manual/elasticjob-lite/usage/operation-api/_index.cn.md
similarity index 62%
copy from docs/content/user-manual/elasticjob-lite/usage/operation-api.en.md
copy to docs/content/user-manual/elasticjob-lite/usage/operation-api/_index.cn.md
index 5275a98..b81f1cc 100644
--- a/docs/content/user-manual/elasticjob-lite/usage/operation-api.en.md
+++ b/docs/content/user-manual/elasticjob-lite/usage/operation-api/_index.cn.md
@@ -1,5 +1,5 @@
 +++
-title = "Operation API"
+title = "操作 API"
 weight = 4
 chapter = true
 +++
diff --git a/docs/content/user-manual/elasticjob-lite/usage/operation-api.en.md b/docs/content/user-manual/elasticjob-lite/usage/operation-api/_index.en.md
similarity index 100%
copy from docs/content/user-manual/elasticjob-lite/usage/operation-api.en.md
copy to docs/content/user-manual/elasticjob-lite/usage/operation-api/_index.en.md
diff --git a/docs/content/user-manual/elasticjob-lite/usage/operation-api.cn.md b/docs/content/user-manual/elasticjob-lite/usage/operation-api/operation-api.cn.md
similarity index 99%
rename from docs/content/user-manual/elasticjob-lite/usage/operation-api.cn.md
rename to docs/content/user-manual/elasticjob-lite/usage/operation-api/operation-api.cn.md
index 08b9eb8..9d8fac9 100644
--- a/docs/content/user-manual/elasticjob-lite/usage/operation-api.cn.md
+++ b/docs/content/user-manual/elasticjob-lite/usage/operation-api/operation-api.cn.md
@@ -1,6 +1,6 @@
 +++
 title = "操作 API"
-weight = 4
+weight = 1
 chapter = true
 +++
 
diff --git a/docs/content/user-manual/elasticjob-lite/usage/operation-api.en.md b/docs/content/user-manual/elasticjob-lite/usage/operation-api/operation-api.en.md
similarity index 82%
rename from docs/content/user-manual/elasticjob-lite/usage/operation-api.en.md
rename to docs/content/user-manual/elasticjob-lite/usage/operation-api/operation-api.en.md
index 5275a98..07f7633 100644
--- a/docs/content/user-manual/elasticjob-lite/usage/operation-api.en.md
+++ b/docs/content/user-manual/elasticjob-lite/usage/operation-api/operation-api.en.md
@@ -1,6 +1,6 @@
 +++
 title = "Operation API"
-weight = 4
+weight = 1
 chapter = true
 +++