To use the Spring namespace, user need to add the dependency of the elasticjob-lite-spring module in the pom.xml file.

  1. <dependency>
  2. <groupId>org.apache.shardingsphere.elasticjob</groupId>
  3. <artifactId>elasticjob-lite-spring-namespace</artifactId>
  4. <version>${latest.release.version}</version>
  5. </dependency>

Spring namespace: http://shardingsphere.apache.org/schema/elasticjob/elasticjob.xsd

Registry Center Configuration

<elasticjob:zookeeper />

Configuration:

NameRequired
idYes
server-listsYes
namespaceYes
base-sleep-time-millisecondsNo
max-sleep-time-millisecondsNo
max-retriesNo
session-timeout-millisecondsNo
connection-timeout-millisecondsNo
digestNo

Job Configuration

<elasticjob:job />

Configuration:

NameRequired
idYes
classNo
job-refNo
registry-center-refYes
tracing-refNo
cronYes
sharding-total-countYes
sharding-item-parametersNo
job-parameterNo
monitor-executionNo
failoverNo
misfireNo
max-time-diff-secondsNo
reconcile-interval-minutesNo
job-sharding-strategy-typeNo
job-executor-service-handler-typeNo
job-error-handler-typeNo
descriptionNo
propsNo
disabledNo
overwriteNo

Event Tracing Configuration

<elasticjob:rdb-tracing />

Configuration:

NameData TypeRequiredDefault ValueDescription
idStringYesThe bean’s identify of the event tracing
data-source-refDataSourceNoThe bean’s name of the event tracing DataSource

Job Dump Configuration

<elasticjob:snapshot />

Configuration:

NameData TypeRequiredDefault ValueDescription
idStringYesThe identify of the monitoring service in the Spring container
registry-center-refStringYesRegistry center bean’s reference, need to the statement of the reg:zookeeper
dump-portStringYesJob dump port
usage: echo “dump@jobName” | nc 127.0.0.1 9888