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 4bc7a43 translate user manual, spring namespace for job-api. (#1120)
4bc7a43 is described below
commit 4bc7a433efe4044744f511f9d8825ee8054d53e7
Author: Zonglei Dong <[email protected]>
AuthorDate: Sat Jul 18 11:11:28 2020 +0800
translate user manual, spring namespace for job-api. (#1120)
---
.../usage/job-api/spring-namespace.en.md | 39 +++++++++++++++++++++-
1 file changed, 38 insertions(+), 1 deletion(-)
diff --git
a/docs/content/user-manual/elasticjob-lite/usage/job-api/spring-namespace.en.md
b/docs/content/user-manual/elasticjob-lite/usage/job-api/spring-namespace.en.md
index 6046e87..ac62305 100644
---
a/docs/content/user-manual/elasticjob-lite/usage/job-api/spring-namespace.en.md
+++
b/docs/content/user-manual/elasticjob-lite/usage/job-api/spring-namespace.en.md
@@ -4,4 +4,41 @@ weight = 4
chapter = true
+++
-TODO
+ElasticJob-Lite provides a custom Spring namespace, which can be used with the
Spring.
+Through the way of DI, developers can easily use data sources and other
objects that managed by the Spring container in their jobs, and use
placeholders to get values from property files.
+
+## Config job for Spring namespace
+
+```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
+ ">
+ <!-- config registry center for job -->
+ <elasticjob:zookeeper id="regCenter" server-lists="yourhost:2181"
namespace="dd-job" base-sleep-time-milliseconds="1000"
max-sleep-time-milliseconds="3000" max-retries="3" />
+
+ <!-- config job java bean -->
+ <bean id="myJob" class="xxx.MyJob">
+ <property name="fooService" ref="xxx.FooService" />
+ </bean>
+
+ <!-- config job scheduler base on java bean -->
+ <elasticjob:job id="${myJob.id}" job-ref="myJob"
registry-center-ref="regCenter"
sharding-total-count="${myJob.shardingTotalCount}" cron="${myJob.cron}" />
+
+ <!-- config job scheduler base on 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>
+```
+
+## Start job
+
+If the Spring container start, the xml that configures the Spring namespace
will be loaded, and the job will be automatically started.