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/06 07:27:44 UTC
[shardingsphere-elasticjob-lite] branch master updated: Add tracing
spring namespace (#965)
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-lite.git
The following commit(s) were added to refs/heads/master by this push:
new 5da9ffc Add tracing spring namespace (#965)
5da9ffc is described below
commit 5da9ffce181dd7df16c18d7e445390fe04ab1cf1
Author: Liang Zhang <te...@163.com>
AuthorDate: Mon Jul 6 15:27:15 2020 +0800
Add tracing spring namespace (#965)
* Refactor job.xsd
* Add tracing spring namespace
* Remove JobBeanDefinitionParser.shouldGenerateId
---
docs/content/01-start/dev-guide.md | 2 +-
docs/content/02-guide/config-manual.md | 2 +-
.../spring/job/parser/JobBeanDefinitionParser.java | 26 ++--------
.../lite/spring/job/tag/JobBeanDefinitionTag.java | 2 +
.../handler/TracingNamespaceHandler.java} | 16 +++---
.../parser/TracingBeanDefinitionParser.java | 40 +++++++++++++++
.../tag/TracingBeanDefinitionTag.java} | 8 +--
.../src/main/resources/META-INF/namespace/job.xsd | 58 ++++++++++------------
.../main/resources/META-INF/namespace/monitor.xsd | 2 +-
.../src/main/resources/META-INF/namespace/reg.xsd | 2 +-
.../namespace/{monitor.xsd => tracing.xsd} | 13 +++--
.../src/main/resources/META-INF/spring.handlers | 1 +
.../src/main/resources/META-INF/spring.schemas | 1 +
.../src/test/resources/META-INF/job/base.xml | 11 +++-
.../resources/META-INF/job/withEventTraceRdb.xml | 9 ++--
.../test/resources/META-INF/job/withJobHandler.xml | 12 +++--
.../src/test/resources/META-INF/job/withJobRef.xml | 12 +++--
.../test/resources/META-INF/job/withListener.xml | 9 +++-
.../META-INF/job/withListenerAndCglib.xml | 12 +++--
.../job/withListenerAndJdkDynamicProxy.xml | 12 +++--
.../resources/META-INF/job/withoutListener.xml | 14 +++---
.../main/resources/META-INF/applicationContext.xml | 35 ++++++++-----
22 files changed, 176 insertions(+), 123 deletions(-)
diff --git a/docs/content/01-start/dev-guide.md b/docs/content/01-start/dev-guide.md
index 3cc5d8d..728c573 100644
--- a/docs/content/01-start/dev-guide.md
+++ b/docs/content/01-start/dev-guide.md
@@ -189,7 +189,7 @@ Root 对应 JobConfiguration,有2个子类分别对应Lite和Cloud部署类型
</job:simple>
<!-- 配置带作业数据库事件追踪的简单作业-->
- <job:simple id="eventTraceElasticJob" class="xxx.MySimpleListenerElasticJob" registry-center-ref="regCenter" cron="0/10 * * * * ?" sharding-total-count="3" sharding-item-parameters="0=A,1=B,2=C" event-trace-rdb-data-source="yourDataSource">
+ <job:simple 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">
</job:simple>
</beans>
```
diff --git a/docs/content/02-guide/config-manual.md b/docs/content/02-guide/config-manual.md
index 039e014..7378fd8 100644
--- a/docs/content/02-guide/config-manual.md
+++ b/docs/content/02-guide/config-manual.md
@@ -119,6 +119,7 @@ Spring 命名空间与 Java Code 方式配置类似,大部分属性只是将
| class | String | 否 | | 作业实现类,需实现ElasticJob接口 |
| job-ref | String | 否 | | 作业关联的beanId,该配置优先级大于class属性配置 |
| registry-center-ref | String | 是 | | 注册中心Bean的引用,需引用reg:zookeeper的声明 |
+| tracing-ref | String | 否 | | 作业事件追踪的数据源Bean引用 |
| cron | String | 是 | | cron表达式,用于控制作业触发时间 |
| sharding-total-count | int | 是 | | 作业分片总数 |
| sharding-item-parameters | String | 否 | | 分片序列号和参数用等号分隔,多个键值对用逗号分隔<br />分片序列号从0开始,不可大于或等于作业分片总数<br />如:<br/>0=a,1=b,2=c|
@@ -134,7 +135,6 @@ Spring 命名空间与 Java Code 方式配置类似,大部分属性只是将
| description | String | 否 | | 作业描述信息 |
| disabled | boolean | 否 | false | 作业是否禁止启动<br />可用于部署作业时,先禁止启动,部署结束后统一启动 |
| overwrite | boolean | 否 | false | 本地配置是否可覆盖注册中心配置<br />如果可覆盖,每次启动作业都以本地配置为准 |
-| event-trace-rdb-data-source | String | 否 | | 作业事件追踪的数据源Bean引用 |
### c. 监控配置
diff --git a/elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/job/parser/JobBeanDefinitionParser.java b/elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/job/parser/JobBeanDefinitionParser.java
index b919ded..6d2e310 100644
--- a/elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/job/parser/JobBeanDefinitionParser.java
+++ b/elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/job/parser/JobBeanDefinitionParser.java
@@ -18,14 +18,11 @@
package org.apache.shardingsphere.elasticjob.lite.spring.job.parser;
import com.google.common.base.Strings;
-import lombok.SneakyThrows;
import org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.OneOffJobBootstrap;
import org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.ScheduleJobBootstrap;
import org.apache.shardingsphere.elasticjob.lite.api.job.JobConfiguration;
-import org.apache.shardingsphere.elasticjob.lite.spring.job.tag.EventTraceBeanDefinitionTag;
import org.apache.shardingsphere.elasticjob.lite.spring.job.tag.JobBeanDefinitionTag;
import org.apache.shardingsphere.elasticjob.lite.spring.job.tag.JobListenerBeanDefinitionTag;
-import org.apache.shardingsphere.elasticjob.lite.tracing.api.TracingConfiguration;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
@@ -43,7 +40,6 @@ import java.util.Properties;
*/
public final class JobBeanDefinitionParser extends AbstractBeanDefinitionParser {
- @SneakyThrows
@Override
protected AbstractBeanDefinition parseInternal(final Element element, final ParserContext parserContext) {
BeanDefinitionBuilder factory;
@@ -56,9 +52,9 @@ public final class JobBeanDefinitionParser extends AbstractBeanDefinitionParser
factory.addConstructorArgReference(element.getAttribute(JobBeanDefinitionTag.REGISTRY_CENTER_REF_ATTRIBUTE));
factory.addConstructorArgReference(element.getAttribute(JobBeanDefinitionTag.JOB_REF_ATTRIBUTE));
factory.addConstructorArgValue(createJobConfigurationBeanDefinition(element, parserContext));
- BeanDefinition tracingConfig = createTracingConfiguration(element);
- if (null != tracingConfig) {
- factory.addConstructorArgValue(tracingConfig);
+ String tracingRef = element.getAttribute(JobBeanDefinitionTag.TRACING_REF_ATTRIBUTE);
+ if (!Strings.isNullOrEmpty(tracingRef)) {
+ factory.addConstructorArgReference(tracingRef);
}
factory.addConstructorArgValue(createJobListeners(element));
return factory.getBeanDefinition();
@@ -91,17 +87,6 @@ public final class JobBeanDefinitionParser extends AbstractBeanDefinitionParser
return null == propsElement ? new Properties() : parserContext.getDelegate().parsePropsElement(propsElement);
}
- private BeanDefinition createTracingConfiguration(final Element element) {
- String eventTraceDataSourceName = element.getAttribute(EventTraceBeanDefinitionTag.EVENT_TRACE_RDB_DATA_SOURCE_ATTRIBUTE);
- if (Strings.isNullOrEmpty(eventTraceDataSourceName)) {
- return null;
- }
- BeanDefinitionBuilder factory = BeanDefinitionBuilder.rootBeanDefinition(TracingConfiguration.class);
- factory.addConstructorArgValue("RDB");
- factory.addConstructorArgReference(eventTraceDataSourceName);
- return factory.getBeanDefinition();
- }
-
private List<BeanDefinition> createJobListeners(final Element element) {
Element listenerElement = DomUtils.getChildElementByTagName(element, JobListenerBeanDefinitionTag.LISTENER_TAG);
Element distributedListenerElement = DomUtils.getChildElementByTagName(element, JobListenerBeanDefinitionTag.DISTRIBUTED_LISTENER_TAG);
@@ -120,9 +105,4 @@ public final class JobBeanDefinitionParser extends AbstractBeanDefinitionParser
}
return result;
}
-
- @Override
- protected boolean shouldGenerateId() {
- return true;
- }
}
diff --git a/elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/job/tag/JobBeanDefinitionTag.java b/elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/job/tag/JobBeanDefinitionTag.java
index 5b096e7..59332b6 100644
--- a/elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/job/tag/JobBeanDefinitionTag.java
+++ b/elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/job/tag/JobBeanDefinitionTag.java
@@ -30,6 +30,8 @@ public final class JobBeanDefinitionTag {
public static final String REGISTRY_CENTER_REF_ATTRIBUTE = "registry-center-ref";
+ public static final String TRACING_REF_ATTRIBUTE = "tracing-ref";
+
public static final String CRON_ATTRIBUTE = "cron";
public static final String SHARDING_TOTAL_COUNT_ATTRIBUTE = "sharding-total-count";
diff --git a/elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/job/tag/EventTraceBeanDefinitionTag.java b/elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/tracing/handler/TracingNamespaceHandler.java
similarity index 62%
copy from elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/job/tag/EventTraceBeanDefinitionTag.java
copy to elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/tracing/handler/TracingNamespaceHandler.java
index c3fbf5d..ca5cd63 100644
--- a/elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/job/tag/EventTraceBeanDefinitionTag.java
+++ b/elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/tracing/handler/TracingNamespaceHandler.java
@@ -15,16 +15,18 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.lite.spring.job.tag;
+package org.apache.shardingsphere.elasticjob.lite.spring.tracing.handler;
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
+import org.apache.shardingsphere.elasticjob.lite.spring.tracing.parser.TracingBeanDefinitionParser;
+import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
/**
- * Event trace bean definition tag.
+ * Tracing handler for spring namespace.
*/
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class EventTraceBeanDefinitionTag {
+public final class TracingNamespaceHandler extends NamespaceHandlerSupport {
- public static final String EVENT_TRACE_RDB_DATA_SOURCE_ATTRIBUTE = "event-trace-rdb-data-source";
+ @Override
+ public void init() {
+ registerBeanDefinitionParser("rdb-event-trace", new TracingBeanDefinitionParser());
+ }
}
diff --git a/elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/tracing/parser/TracingBeanDefinitionParser.java b/elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/tracing/parser/TracingBeanDefinitionParser.java
new file mode 100644
index 0000000..fcc8465
--- /dev/null
+++ b/elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/tracing/parser/TracingBeanDefinitionParser.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.elasticjob.lite.spring.tracing.parser;
+
+import org.apache.shardingsphere.elasticjob.lite.spring.tracing.tag.TracingBeanDefinitionTag;
+import org.apache.shardingsphere.elasticjob.lite.tracing.api.TracingConfiguration;
+import org.springframework.beans.factory.support.AbstractBeanDefinition;
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser;
+import org.springframework.beans.factory.xml.ParserContext;
+import org.w3c.dom.Element;
+
+/**
+ * Job bean definition parser.
+ */
+public final class TracingBeanDefinitionParser extends AbstractBeanDefinitionParser {
+
+ @Override
+ protected AbstractBeanDefinition parseInternal(final Element element, final ParserContext parserContext) {
+ BeanDefinitionBuilder factory = BeanDefinitionBuilder.rootBeanDefinition(TracingConfiguration.class);
+ factory.addConstructorArgValue("RDB");
+ factory.addConstructorArgReference(element.getAttribute(TracingBeanDefinitionTag.DATA_SOURCE_REF_ATTRIBUTE));
+ return factory.getBeanDefinition();
+ }
+}
diff --git a/elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/job/tag/EventTraceBeanDefinitionTag.java b/elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/tracing/tag/TracingBeanDefinitionTag.java
similarity index 78%
rename from elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/job/tag/EventTraceBeanDefinitionTag.java
rename to elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/tracing/tag/TracingBeanDefinitionTag.java
index c3fbf5d..410d16c 100644
--- a/elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/job/tag/EventTraceBeanDefinitionTag.java
+++ b/elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/tracing/tag/TracingBeanDefinitionTag.java
@@ -15,16 +15,16 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.lite.spring.job.tag;
+package org.apache.shardingsphere.elasticjob.lite.spring.tracing.tag;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
/**
- * Event trace bean definition tag.
+ * Tracing bean definition tag.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class EventTraceBeanDefinitionTag {
+public final class TracingBeanDefinitionTag {
- public static final String EVENT_TRACE_RDB_DATA_SOURCE_ATTRIBUTE = "event-trace-rdb-data-source";
+ public static final String DATA_SOURCE_REF_ATTRIBUTE = "data-source-ref";
}
diff --git a/elastic-job-lite-spring/src/main/resources/META-INF/namespace/job.xsd b/elastic-job-lite-spring/src/main/resources/META-INF/namespace/job.xsd
index f85ce75..2aaed8c 100644
--- a/elastic-job-lite-spring/src/main/resources/META-INF/namespace/job.xsd
+++ b/elastic-job-lite-spring/src/main/resources/META-INF/namespace/job.xsd
@@ -21,7 +21,7 @@
xmlns:beans="http://www.springframework.org/schema/beans"
targetNamespace="http://elasticjob.shardingsphere.apache.org/schema/job"
elementFormDefault="qualified">
- <xsd:import namespace="http://www.springframework.org/schema/beans" />
+ <xsd:import namespace="http://www.springframework.org/schema/beans" schemaLocation="http://www.springframework.org/schema/beans/spring-beans.xsd" />
<xsd:element name="listener">
<xsd:complexType>
@@ -36,40 +36,34 @@
</xsd:complexType>
</xsd:element>
- <xsd:complexType name="base">
- <xsd:complexContent>
- <xsd:extension base="beans:identifiedType">
- <xsd:all>
- <xsd:element ref="beans:props" minOccurs="0" />
- <xsd:element ref="listener" minOccurs="0" />
- <xsd:element ref="distributed-listener" minOccurs="0" />
- </xsd:all>
- <xsd:attribute name="job-ref" type="xsd:string" />
- <xsd:attribute name="registry-center-ref" type="xsd:string" use="required" />
- <xsd:attribute name="sharding-total-count" type="xsd:string" use="required" />
- <xsd:attribute name="cron" type="xsd:string" />
- <xsd:attribute name="sharding-item-parameters" type="xsd:string" />
- <xsd:attribute name="job-parameter" type="xsd:string" />
- <xsd:attribute name="monitor-execution" type="xsd:string" default="true" />
- <xsd:attribute name="max-time-diff-seconds" type="xsd:string" default="-1" />
- <xsd:attribute name="failover" type="xsd:string" default="false" />
- <xsd:attribute name="reconcile-interval-minutes" type="xsd:string" default="10" />
- <xsd:attribute name="misfire" type="xsd:string" default="true" />
- <xsd:attribute name="job-sharding-strategy-type" type="xsd:string" />
- <xsd:attribute name="job-executor-service-handler-type" type="xsd:string" />
- <xsd:attribute name="job-error-handler-type" type="xsd:string" />
- <xsd:attribute name="description" type="xsd:string" />
- <xsd:attribute name="disabled" type="xsd:string" default="false" />
- <xsd:attribute name="overwrite" type="xsd:string" default="false" />
- <xsd:attribute name="event-trace-rdb-data-source" type="xsd:string" />
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
-
<xsd:element name="job">
<xsd:complexType>
<xsd:complexContent>
- <xsd:extension base="base" />
+ <xsd:extension base="beans:identifiedType">
+ <xsd:all>
+ <xsd:element ref="beans:props" minOccurs="0" />
+ <xsd:element ref="listener" minOccurs="0" />
+ <xsd:element ref="distributed-listener" minOccurs="0" />
+ </xsd:all>
+ <xsd:attribute name="job-ref" type="xsd:string" />
+ <xsd:attribute name="registry-center-ref" type="xsd:string" use="required" />
+ <xsd:attribute name="tracing-ref" type="xsd:string" />
+ <xsd:attribute name="sharding-total-count" type="xsd:string" use="required" />
+ <xsd:attribute name="cron" type="xsd:string" />
+ <xsd:attribute name="sharding-item-parameters" type="xsd:string" />
+ <xsd:attribute name="job-parameter" type="xsd:string" />
+ <xsd:attribute name="monitor-execution" type="xsd:string" default="true" />
+ <xsd:attribute name="max-time-diff-seconds" type="xsd:string" default="-1" />
+ <xsd:attribute name="failover" type="xsd:string" default="false" />
+ <xsd:attribute name="reconcile-interval-minutes" type="xsd:string" default="10" />
+ <xsd:attribute name="misfire" type="xsd:string" default="true" />
+ <xsd:attribute name="job-sharding-strategy-type" type="xsd:string" />
+ <xsd:attribute name="job-executor-service-handler-type" type="xsd:string" />
+ <xsd:attribute name="job-error-handler-type" type="xsd:string" />
+ <xsd:attribute name="description" type="xsd:string" />
+ <xsd:attribute name="disabled" type="xsd:string" default="false" />
+ <xsd:attribute name="overwrite" type="xsd:string" default="false" />
+ </xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
diff --git a/elastic-job-lite-spring/src/main/resources/META-INF/namespace/monitor.xsd b/elastic-job-lite-spring/src/main/resources/META-INF/namespace/monitor.xsd
index c7226ed..43e47a2 100644
--- a/elastic-job-lite-spring/src/main/resources/META-INF/namespace/monitor.xsd
+++ b/elastic-job-lite-spring/src/main/resources/META-INF/namespace/monitor.xsd
@@ -21,7 +21,7 @@
xmlns:beans="http://www.springframework.org/schema/beans"
targetNamespace="http://elasticjob.shardingsphere.apache.org/schema/monitor"
elementFormDefault="qualified">
- <xsd:import namespace="http://www.springframework.org/schema/beans" />
+ <xsd:import namespace="http://www.springframework.org/schema/beans" schemaLocation="http://www.springframework.org/schema/beans/spring-beans.xsd" />
<xsd:element name="embed">
<xsd:complexType>
diff --git a/elastic-job-lite-spring/src/main/resources/META-INF/namespace/reg.xsd b/elastic-job-lite-spring/src/main/resources/META-INF/namespace/reg.xsd
index 3332bd2..cf021c0 100644
--- a/elastic-job-lite-spring/src/main/resources/META-INF/namespace/reg.xsd
+++ b/elastic-job-lite-spring/src/main/resources/META-INF/namespace/reg.xsd
@@ -21,7 +21,7 @@
xmlns:beans="http://www.springframework.org/schema/beans"
targetNamespace="http://elasticjob.shardingsphere.apache.org/schema/reg"
elementFormDefault="qualified">
- <xsd:import namespace="http://www.springframework.org/schema/beans" />
+ <xsd:import namespace="http://www.springframework.org/schema/beans" schemaLocation="http://www.springframework.org/schema/beans/spring-beans.xsd" />
<xsd:element name="zookeeper">
<xsd:complexType>
diff --git a/elastic-job-lite-spring/src/main/resources/META-INF/namespace/monitor.xsd b/elastic-job-lite-spring/src/main/resources/META-INF/namespace/tracing.xsd
similarity index 84%
copy from elastic-job-lite-spring/src/main/resources/META-INF/namespace/monitor.xsd
copy to elastic-job-lite-spring/src/main/resources/META-INF/namespace/tracing.xsd
index c7226ed..6e1e2d1 100644
--- a/elastic-job-lite-spring/src/main/resources/META-INF/namespace/monitor.xsd
+++ b/elastic-job-lite-spring/src/main/resources/META-INF/namespace/tracing.xsd
@@ -8,7 +8,7 @@
~ the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
- ~
+ ~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,19 +16,18 @@
~ limitations under the License.
-->
-<xsd:schema xmlns="http://elasticjob.shardingsphere.apache.org/schema/monitor"
+<xsd:schema xmlns="http://elasticjob.shardingsphere.apache.org/schema/tracing"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:beans="http://www.springframework.org/schema/beans"
- targetNamespace="http://elasticjob.shardingsphere.apache.org/schema/monitor"
+ targetNamespace="http://elasticjob.shardingsphere.apache.org/schema/tracing"
elementFormDefault="qualified">
- <xsd:import namespace="http://www.springframework.org/schema/beans" />
+ <xsd:import namespace="http://www.springframework.org/schema/beans" schemaLocation="http://www.springframework.org/schema/beans/spring-beans.xsd" />
- <xsd:element name="embed">
+ <xsd:element name="rdb-event-trace">
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="beans:identifiedType">
- <xsd:attribute name="registry-center-ref" type="xsd:string" use="required" />
- <xsd:attribute name="monitor-port" type="xsd:string" default="-1" />
+ <xsd:attribute name="data-source-ref" type="xsd:string" use="required" />
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
diff --git a/elastic-job-lite-spring/src/main/resources/META-INF/spring.handlers b/elastic-job-lite-spring/src/main/resources/META-INF/spring.handlers
index eaf6a89..7a2abac 100644
--- a/elastic-job-lite-spring/src/main/resources/META-INF/spring.handlers
+++ b/elastic-job-lite-spring/src/main/resources/META-INF/spring.handlers
@@ -17,4 +17,5 @@
http\://elasticjob.shardingsphere.apache.org/schema/reg=org.apache.shardingsphere.elasticjob.lite.spring.reg.handler.RegNamespaceHandler
http\://elasticjob.shardingsphere.apache.org/schema/job=org.apache.shardingsphere.elasticjob.lite.spring.job.handler.JobNamespaceHandler
+http\://elasticjob.shardingsphere.apache.org/schema/tracing=org.apache.shardingsphere.elasticjob.lite.spring.tracing.handler.TracingNamespaceHandler
http\://elasticjob.shardingsphere.apache.org/schema/monitor=org.apache.shardingsphere.elasticjob.lite.spring.monitor.handler.MonitorNamespaceHandler
diff --git a/elastic-job-lite-spring/src/main/resources/META-INF/spring.schemas b/elastic-job-lite-spring/src/main/resources/META-INF/spring.schemas
index 988fb6b..6c5e23f 100644
--- a/elastic-job-lite-spring/src/main/resources/META-INF/spring.schemas
+++ b/elastic-job-lite-spring/src/main/resources/META-INF/spring.schemas
@@ -17,4 +17,5 @@
http\://elasticjob.shardingsphere.apache.org/schema/reg/reg.xsd=META-INF/namespace/reg.xsd
http\://elasticjob.shardingsphere.apache.org/schema/job/job.xsd=META-INF/namespace/job.xsd
+http\://elasticjob.shardingsphere.apache.org/schema/tracing/tracing.xsd=META-INF/namespace/tracing.xsd
http\://elasticjob.shardingsphere.apache.org/schema/monitor/monitor.xsd=META-INF/namespace/monitor.xsd
diff --git a/elastic-job-lite-spring/src/test/resources/META-INF/job/base.xml b/elastic-job-lite-spring/src/test/resources/META-INF/job/base.xml
index bb3e4c2..eec6ef3 100644
--- a/elastic-job-lite-spring/src/test/resources/META-INF/job/base.xml
+++ b/elastic-job-lite-spring/src/test/resources/META-INF/job/base.xml
@@ -20,21 +20,28 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:reg="http://elasticjob.shardingsphere.apache.org/schema/reg"
+ xmlns:tracing="http://elasticjob.shardingsphere.apache.org/schema/tracing"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://elasticjob.shardingsphere.apache.org/schema/reg
http://elasticjob.shardingsphere.apache.org/schema/reg/reg.xsd
+ http://elasticjob.shardingsphere.apache.org/schema/tracing
+ http://elasticjob.shardingsphere.apache.org/schema/tracing/tracing.xsd
">
<context:property-placeholder location="classpath:conf/job/conf.properties" />
+
<reg:zookeeper id="regCenter" server-lists="${regCenter.serverLists}" namespace="${regCenter.namespace}" base-sleep-time-milliseconds="${regCenter.baseSleepTimeMilliseconds}"
max-sleep-time-milliseconds="${regCenter.maxSleepTimeMilliseconds}" max-retries="${regCenter.maxRetries}" />
- <bean id="foo" class="org.apache.shardingsphere.elasticjob.lite.spring.fixture.service.FooServiceImpl" />
- <bean id="elasticJobLog" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
+
+ <bean id="elasticJobTracingDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="org.h2.Driver" />
<property name="url" value="jdbc:h2:mem:job_event_storage" />
<property name="username" value="sa" />
<property name="password" value="" />
</bean>
+ <tracing:rdb-event-trace id="elasticJobTrace" data-source-ref="elasticJobTracingDataSource" />
+
+ <bean id="foo" class="org.apache.shardingsphere.elasticjob.lite.spring.fixture.service.FooServiceImpl" />
</beans>
diff --git a/elastic-job-lite-spring/src/test/resources/META-INF/job/withEventTraceRdb.xml b/elastic-job-lite-spring/src/test/resources/META-INF/job/withEventTraceRdb.xml
index 9471904..bee4f97 100644
--- a/elastic-job-lite-spring/src/test/resources/META-INF/job/withEventTraceRdb.xml
+++ b/elastic-job-lite-spring/src/test/resources/META-INF/job/withEventTraceRdb.xml
@@ -29,9 +29,10 @@
<bean id="fooJob" class="org.apache.shardingsphere.elasticjob.lite.spring.fixture.job.FooSimpleElasticJob" />
<bean id="dataflowJob" class="org.apache.shardingsphere.elasticjob.lite.spring.fixture.job.DataflowElasticJob" />
- <job:job id="simpleElasticJob_namespace_event_trace_rdb" job-ref="fooJob" registry-center-ref="regCenter"
- cron="${simpleJob.cron}" sharding-total-count="${simpleJob.shardingTotalCount}" sharding-item-parameters="${simpleJob.shardingItemParameters}" disabled="${simpleJob.disabled}"
- overwrite="${simpleJob.overwrite}" job-executor-service-handler-type="SINGLE_THREAD" event-trace-rdb-data-source="elasticJobLog" />
+ <job:job id="simpleElasticJob_namespace_event_trace_rdb" job-ref="fooJob" registry-center-ref="regCenter" tracing-ref="elasticJobTrace"
+ cron="${simpleJob.cron}" sharding-total-count="${simpleJob.shardingTotalCount}" sharding-item-parameters="${simpleJob.shardingItemParameters}" job-executor-service-handler-type="SINGLE_THREAD"
+ disabled="${simpleJob.disabled}" overwrite="${simpleJob.overwrite}" />
+
<job:job id="dataflowElasticJob_namespace_event_trace_rdb" job-ref="dataflowJob" registry-center-ref="regCenter"
- cron="0/1 * * * * ?" sharding-total-count="3" sharding-item-parameters="0=A,1=B,2=C" job-error-handler-type="THROW" description="中文描述" overwrite="true" />
+ cron="0/1 * * * * ?" sharding-total-count="3" sharding-item-parameters="0=A,1=B,2=C" job-error-handler-type="THROW" description="中文描述" overwrite="true" />
</beans>
diff --git a/elastic-job-lite-spring/src/test/resources/META-INF/job/withJobHandler.xml b/elastic-job-lite-spring/src/test/resources/META-INF/job/withJobHandler.xml
index ce80450..e4b1651 100644
--- a/elastic-job-lite-spring/src/test/resources/META-INF/job/withJobHandler.xml
+++ b/elastic-job-lite-spring/src/test/resources/META-INF/job/withJobHandler.xml
@@ -29,9 +29,11 @@
<bean id="fooJob" class="org.apache.shardingsphere.elasticjob.lite.spring.fixture.job.FooSimpleElasticJob" />
<bean id="dataflowJob" class="org.apache.shardingsphere.elasticjob.lite.spring.fixture.job.DataflowElasticJob" />
- <job:job id="simpleElasticJob_namespace_job_handler" job-ref="fooJob"
- registry-center-ref="regCenter" cron="${simpleJob.cron}" sharding-total-count="${simpleJob.shardingTotalCount}" sharding-item-parameters="${simpleJob.shardingItemParameters}"
- disabled="${simpleJob.disabled}" overwrite="${simpleJob.overwrite}" job-executor-service-handler-type="SINGLE_THREAD" />
- <job:job id="dataflowElasticJob_namespace_job_handler" job-ref="dataflowJob" registry-center-ref="regCenter" cron="0/1 * * * * ?" sharding-total-count="3" sharding-item-parameters="0=A,1=B,2=C"
- job-error-handler-type="THROW" description="中文描述" overwrite="true" />
+ <job:job id="simpleElasticJob_namespace_job_handler" job-ref="fooJob" registry-center-ref="regCenter"
+ cron="${simpleJob.cron}" sharding-total-count="${simpleJob.shardingTotalCount}" sharding-item-parameters="${simpleJob.shardingItemParameters}" job-executor-service-handler-type="SINGLE_THREAD"
+ disabled="${simpleJob.disabled}" overwrite="${simpleJob.overwrite}" />
+
+ <job:job id="dataflowElasticJob_namespace_job_handler" job-ref="dataflowJob" registry-center-ref="regCenter"
+ cron="0/1 * * * * ?" sharding-total-count="3" sharding-item-parameters="0=A,1=B,2=C" job-error-handler-type="THROW" description="中文描述"
+ overwrite="true" />
</beans>
diff --git a/elastic-job-lite-spring/src/test/resources/META-INF/job/withJobRef.xml b/elastic-job-lite-spring/src/test/resources/META-INF/job/withJobRef.xml
index 26d0361..7c73bed 100644
--- a/elastic-job-lite-spring/src/test/resources/META-INF/job/withJobRef.xml
+++ b/elastic-job-lite-spring/src/test/resources/META-INF/job/withJobRef.xml
@@ -25,6 +25,7 @@
http://elasticjob.shardingsphere.apache.org/schema/job/job.xsd
">
<import resource="base.xml"/>
+
<bean id="refSimpleJob" class="org.apache.shardingsphere.elasticjob.lite.spring.fixture.job.ref.RefFooSimpleElasticJob">
<property name="fooService" ref="foo" />
</bean>
@@ -32,10 +33,13 @@
<property name="fooService" ref="foo" />
</bean>
- <job:job id="simpleElasticJob_job_ref" job-ref="refSimpleJob" registry-center-ref="regCenter" cron="${simpleJob.cron}" sharding-total-count="${simpleJob.shardingTotalCount}"
- sharding-item-parameters="${simpleJob.shardingItemParameters}" disabled="${simpleJob.disabled}" overwrite="${simpleJob.overwrite}" job-executor-service-handler-type="SINGLE_THREAD" />
- <job:job id="dataflowElasticJob_job_ref" job-ref="refDataflowJob" registry-center-ref="regCenter" cron="${dataflowJob.cron}" sharding-total-count="${dataflowJob.shardingTotalCount}"
- sharding-item-parameters="${dataflowJob.shardingItemParameters}" overwrite="${dataflowJob.overwrite}">
+ <job:job id="simpleElasticJob_job_ref" job-ref="refSimpleJob" registry-center-ref="regCenter"
+ cron="${simpleJob.cron}" sharding-total-count="${simpleJob.shardingTotalCount}" sharding-item-parameters="${simpleJob.shardingItemParameters}"
+ disabled="${simpleJob.disabled}" overwrite="${simpleJob.overwrite}" job-executor-service-handler-type="SINGLE_THREAD" />
+
+ <job:job id="dataflowElasticJob_job_ref" job-ref="refDataflowJob" registry-center-ref="regCenter"
+ cron="${dataflowJob.cron}" sharding-total-count="${dataflowJob.shardingTotalCount}" sharding-item-parameters="${dataflowJob.shardingItemParameters}"
+ overwrite="${dataflowJob.overwrite}">
<props>
<prop key="streaming.process">${dataflowJob.streamingProcess}</prop>
</props>
diff --git a/elastic-job-lite-spring/src/test/resources/META-INF/job/withListener.xml b/elastic-job-lite-spring/src/test/resources/META-INF/job/withListener.xml
index 29ddde2..a533861 100644
--- a/elastic-job-lite-spring/src/test/resources/META-INF/job/withListener.xml
+++ b/elastic-job-lite-spring/src/test/resources/META-INF/job/withListener.xml
@@ -29,9 +29,14 @@
<bean id="fooJob" class="org.apache.shardingsphere.elasticjob.lite.spring.fixture.job.FooSimpleElasticJob" />
<bean id="dataflowJob" class="org.apache.shardingsphere.elasticjob.lite.spring.fixture.job.DataflowElasticJob" />
- <job:job id="${simpleJob.id}" job-ref="fooJob" registry-center-ref="regCenter" cron="${simpleJob.cron}" sharding-total-count="${simpleJob.shardingTotalCount}" sharding-item-parameters="${simpleJob.shardingItemParameters}" disabled="${simpleJob.disabled}" overwrite="${simpleJob.overwrite}">
+ <job:job id="${simpleJob.id}" job-ref="fooJob" registry-center-ref="regCenter"
+ cron="${simpleJob.cron}" sharding-total-count="${simpleJob.shardingTotalCount}" sharding-item-parameters="${simpleJob.shardingItemParameters}"
+ disabled="${simpleJob.disabled}" overwrite="${simpleJob.overwrite}">
<job:listener class="org.apache.shardingsphere.elasticjob.lite.spring.fixture.listener.SimpleListener" />
<job:distributed-listener class="org.apache.shardingsphere.elasticjob.lite.spring.fixture.listener.SimpleOnceListener" started-timeout-milliseconds="10000" completed-timeout-milliseconds="20000" />
</job:job>
- <job:job id="dataflowElasticJob_namespace_listener" job-ref="dataflowJob" registry-center-ref="regCenter" cron="0/1 * * * * ?" sharding-total-count="3" sharding-item-parameters="0=A,1=B,2=C" description="中文描述" overwrite="true" />
+
+ <job:job id="dataflowElasticJob_namespace_listener" job-ref="dataflowJob" registry-center-ref="regCenter"
+ cron="0/1 * * * * ?" sharding-total-count="3" sharding-item-parameters="0=A,1=B,2=C" description="中文描述"
+ overwrite="true" />
</beans>
diff --git a/elastic-job-lite-spring/src/test/resources/META-INF/job/withListenerAndCglib.xml b/elastic-job-lite-spring/src/test/resources/META-INF/job/withListenerAndCglib.xml
index 615a6ac..d0f855a 100644
--- a/elastic-job-lite-spring/src/test/resources/META-INF/job/withListenerAndCglib.xml
+++ b/elastic-job-lite-spring/src/test/resources/META-INF/job/withListenerAndCglib.xml
@@ -32,18 +32,20 @@
">
<context:component-scan base-package="org.apache.shardingsphere.elasticjob.lite.spring.fixture.aspect,org.apache.shardingsphere.elasticjob.lite.spring.fixture.service" />
<aop:aspectj-autoproxy proxy-target-class="true" />
+
<import resource="base.xml"/>
<bean id="fooJob" class="org.apache.shardingsphere.elasticjob.lite.spring.fixture.job.FooSimpleElasticJob" />
<bean id="dataflowJob" class="org.apache.shardingsphere.elasticjob.lite.spring.fixture.job.DataflowElasticJob" />
- <job:job id="simpleElasticJob_namespace_listener_cglib" job-ref="fooJob"
- registry-center-ref="regCenter" cron="${simpleJob.cron}" sharding-total-count="${simpleJob.shardingTotalCount}" sharding-item-parameters="${simpleJob.shardingItemParameters}"
- disabled="${simpleJob.disabled}" overwrite="${simpleJob.overwrite}" event-trace-rdb-data-source="elasticJobLog">
+ <job:job id="simpleElasticJob_namespace_listener_cglib" job-ref="fooJob" registry-center-ref="regCenter" tracing-ref="elasticJobTrace"
+ cron="${simpleJob.cron}" sharding-total-count="${simpleJob.shardingTotalCount}" sharding-item-parameters="${simpleJob.shardingItemParameters}"
+ disabled="${simpleJob.disabled}" overwrite="${simpleJob.overwrite}">
<job:listener class="org.apache.shardingsphere.elasticjob.lite.spring.fixture.listener.SimpleCglibListener" />
</job:job>
- <job:job id="dataflowElasticJob_namespace_listener_cglib" job-ref="dataflowJob"
- registry-center-ref="regCenter" cron="0/1 * * * * ?" sharding-total-count="3" sharding-item-parameters="0=A,1=B,2=C" description="中文描述" overwrite="true">
+ <job:job id="dataflowElasticJob_namespace_listener_cglib" job-ref="dataflowJob" registry-center-ref="regCenter"
+ cron="0/1 * * * * ?" sharding-total-count="3" sharding-item-parameters="0=A,1=B,2=C" description="中文描述"
+ overwrite="true">
<props>
<prop key="streaming.process">true</prop>
</props>
diff --git a/elastic-job-lite-spring/src/test/resources/META-INF/job/withListenerAndJdkDynamicProxy.xml b/elastic-job-lite-spring/src/test/resources/META-INF/job/withListenerAndJdkDynamicProxy.xml
index f5fc3fb..9b5572a 100644
--- a/elastic-job-lite-spring/src/test/resources/META-INF/job/withListenerAndJdkDynamicProxy.xml
+++ b/elastic-job-lite-spring/src/test/resources/META-INF/job/withListenerAndJdkDynamicProxy.xml
@@ -32,18 +32,20 @@
">
<context:component-scan base-package="org.apache.shardingsphere.elasticjob.lite.spring.fixture.aspect,org.apache.shardingsphere.elasticjob.lite.spring.fixture.service" />
<aop:aspectj-autoproxy />
+
<import resource="base.xml" />
<bean id="fooJob" class="org.apache.shardingsphere.elasticjob.lite.spring.fixture.job.FooSimpleElasticJob" />
<bean id="dataflowJob" class="org.apache.shardingsphere.elasticjob.lite.spring.fixture.job.DataflowElasticJob" />
- <job:job id="simpleElasticJob_namespace_listener_jdk_proxy" job-ref="fooJob"
- registry-center-ref="regCenter" cron="${simpleJob.cron}" sharding-total-count="${simpleJob.shardingTotalCount}" sharding-item-parameters="${simpleJob.shardingItemParameters}"
- disabled="${simpleJob.disabled}" overwrite="${simpleJob.overwrite}" event-trace-rdb-data-source="elasticJobLog">
+ <job:job id="simpleElasticJob_namespace_listener_jdk_proxy" job-ref="fooJob" registry-center-ref="regCenter" tracing-ref="elasticJobTrace"
+ cron="${simpleJob.cron}" sharding-total-count="${simpleJob.shardingTotalCount}" sharding-item-parameters="${simpleJob.shardingItemParameters}"
+ disabled="${simpleJob.disabled}" overwrite="${simpleJob.overwrite}">
<job:listener class="org.apache.shardingsphere.elasticjob.lite.spring.fixture.listener.SimpleJdkDynamicProxyListener" />
</job:job>
- <job:job id="dataflowElasticJob_namespace_listener_jdk_proxy" job-ref="dataflowJob"
- registry-center-ref="regCenter" cron="0/1 * * * * ?" sharding-total-count="3" sharding-item-parameters="0=A,1=B,2=C" description="中文描述" overwrite="true">
+ <job:job id="dataflowElasticJob_namespace_listener_jdk_proxy" job-ref="dataflowJob" registry-center-ref="regCenter"
+ cron="0/1 * * * * ?" sharding-total-count="3" sharding-item-parameters="0=A,1=B,2=C" description="中文描述"
+ overwrite="true">
<props>
<prop key="streaming.process">true</prop>
</props>
diff --git a/elastic-job-lite-spring/src/test/resources/META-INF/job/withoutListener.xml b/elastic-job-lite-spring/src/test/resources/META-INF/job/withoutListener.xml
index 919dba4..764304e 100644
--- a/elastic-job-lite-spring/src/test/resources/META-INF/job/withoutListener.xml
+++ b/elastic-job-lite-spring/src/test/resources/META-INF/job/withoutListener.xml
@@ -29,13 +29,13 @@
<bean id="fooJob" class="org.apache.shardingsphere.elasticjob.lite.spring.fixture.job.FooSimpleElasticJob" />
<bean id="dataflowJob" class="org.apache.shardingsphere.elasticjob.lite.spring.fixture.job.DataflowElasticJob" />
- <job:job id="simpleElasticJob_namespace" job-ref="fooJob"
- registry-center-ref="regCenter" cron="${simpleJob.cron}" sharding-total-count="${simpleJob.shardingTotalCount}" sharding-item-parameters="${simpleJob.shardingItemParameters}"
- disabled="${simpleJob.disabled}" overwrite="${simpleJob.overwrite}" />
- <job:job id="dataflowElasticJob_namespace" job-ref="dataflowJob"
- registry-center-ref="regCenter" sharding-total-count="${dataflowJob.shardingTotalCount}" cron="${dataflowJob.cron}" sharding-item-parameters="${dataflowJob.shardingItemParameters}"
- monitor-execution="${dataflowJob.monitorExecution}" failover="${dataflowJob.failover}" description="${dataflowJob.description}" disabled="${dataflowJob.disabled}"
- overwrite="${dataflowJob.overwrite}">
+ <job:job id="simpleElasticJob_namespace" job-ref="fooJob" registry-center-ref="regCenter"
+ cron="${simpleJob.cron}" sharding-total-count="${simpleJob.shardingTotalCount}" sharding-item-parameters="${simpleJob.shardingItemParameters}"
+ disabled="${simpleJob.disabled}" overwrite="${simpleJob.overwrite}" />
+ <job:job id="dataflowElasticJob_namespace" job-ref="dataflowJob" registry-center-ref="regCenter"
+ sharding-total-count="${dataflowJob.shardingTotalCount}" cron="${dataflowJob.cron}" sharding-item-parameters="${dataflowJob.shardingItemParameters}"
+ monitor-execution="${dataflowJob.monitorExecution}" failover="${dataflowJob.failover}" description="${dataflowJob.description}"
+ disabled="${dataflowJob.disabled}" overwrite="${dataflowJob.overwrite}">
<props>
<prop key="streaming.process">${dataflowJob.streamingProcess}</prop>
</props>
diff --git a/examples/elastic-job-example-lite-spring/src/main/resources/META-INF/applicationContext.xml b/examples/elastic-job-example-lite-spring/src/main/resources/META-INF/applicationContext.xml
index 662d26e..f77aa76 100644
--- a/examples/elastic-job-example-lite-spring/src/main/resources/META-INF/applicationContext.xml
+++ b/examples/elastic-job-example-lite-spring/src/main/resources/META-INF/applicationContext.xml
@@ -16,44 +16,55 @@
~ limitations under the License.
-->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context"
- xmlns:reg="http://elasticjob.shardingsphere.apache.org/schema/reg"
- xmlns:job="http://elasticjob.shardingsphere.apache.org/schema/job"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:reg="http://elasticjob.shardingsphere.apache.org/schema/reg"
+ xmlns:tracing="http://elasticjob.shardingsphere.apache.org/schema/tracing"
+ xmlns:job="http://elasticjob.shardingsphere.apache.org/schema/job"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://elasticjob.shardingsphere.apache.org/schema/reg
http://elasticjob.shardingsphere.apache.org/schema/reg/reg.xsd
+ http://elasticjob.shardingsphere.apache.org/schema/tracing
+ http://elasticjob.shardingsphere.apache.org/schema/tracing/tracing.xsd
http://elasticjob.shardingsphere.apache.org/schema/job
http://elasticjob.shardingsphere.apache.org/schema/job/job.xsd
">
<context:component-scan base-package="org.apache.shardingsphere.elasticjob.lite.example" />
<context:property-placeholder location="classpath:conf/*.properties" />
- <bean id="elasticJobLog" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
+ <reg:zookeeper id="regCenter" server-lists="${serverLists}" namespace="${namespace}" base-sleep-time-milliseconds="${baseSleepTimeMilliseconds}" max-sleep-time-milliseconds="${maxSleepTimeMilliseconds}" max-retries="${maxRetries}" />
+
+ <bean id="elasticJobTracingDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${event.rdb.driver}"/>
<property name="url" value="${event.rdb.url}"/>
<property name="username" value="${event.rdb.username}"/>
<property name="password" value="${event.rdb.password}"/>
</bean>
+ <tracing:rdb-event-trace id="elasticJobTrace" data-source-ref="elasticJobTracingDataSource" />
- <reg:zookeeper id="regCenter" server-lists="${serverLists}" namespace="${namespace}" base-sleep-time-milliseconds="${baseSleepTimeMilliseconds}" max-sleep-time-milliseconds="${maxSleepTimeMilliseconds}" max-retries="${maxRetries}" />
-
<bean id="simpleJob" class="org.apache.shardingsphere.elasticjob.lite.example.job.simple.SpringSimpleJob" />
<bean id="dataflowJob" class="org.apache.shardingsphere.elasticjob.lite.example.job.dataflow.SpringDataflowJob" />
- <job:job id="${simple.id}" job-ref="simpleJob" registry-center-ref="regCenter" sharding-total-count="${simple.shardingTotalCount}" cron="${simple.cron}" sharding-item-parameters="${simple.shardingItemParameters}" monitor-execution="${simple.monitorExecution}" failover="${simple.failover}" description="${simple.description}" disabled="${simple.disabled}" overwrite="${simple.overwrite}" event-trace-rdb-data-source="elasticJobLog" />
- <job:job id="${dataflow.id}" job-ref="dataflowJob" registry-center-ref="regCenter" sharding-total-count="${dataflow.shardingTotalCount}" cron="${dataflow.cron}" sharding-item-parameters="${dataflow.shardingItemParameters}" monitor-execution="${dataflow.monitorExecution}" failover="${dataflow.failover}" max-time-diff-seconds="${dataflow.maxTimeDiffSeconds}" description="${dataflow.description}" disabled="${dataflow.disabled}" overwrite="${dataflow.overwrite}">
+ <job:job id="${simple.id}" job-ref="simpleJob" registry-center-ref="regCenter" tracing-ref="elasticJobTrace"
+ sharding-total-count="${simple.shardingTotalCount}" cron="${simple.cron}" sharding-item-parameters="${simple.shardingItemParameters}" monitor-execution="${simple.monitorExecution}" failover="${simple.failover}" description="${simple.description}"
+ disabled="${simple.disabled}" overwrite="${simple.overwrite}" />
+
+ <job:job id="${dataflow.id}" job-ref="dataflowJob" registry-center-ref="regCenter"
+ sharding-total-count="${dataflow.shardingTotalCount}" cron="${dataflow.cron}" sharding-item-parameters="${dataflow.shardingItemParameters}" monitor-execution="${dataflow.monitorExecution}" failover="${dataflow.failover}" max-time-diff-seconds="${dataflow.maxTimeDiffSeconds}" description="${dataflow.description}"
+ disabled="${dataflow.disabled}" overwrite="${dataflow.overwrite}">
<props>
<prop key="streaming.process">${dataflow.streamingProcess}</prop>
</props>
</job:job>
<!-- use absolute path to run script job -->
- <!--<job:job id="${script.id}" registry-center-ref="regCenter" sharding-total-count="${script.shardingTotalCount}" cron="${script.cron}" sharding-item-parameters="${script.shardingItemParameters}" description="${script.description}" overwrite="${script.overwrite}">-->
+ <!--<job:job id="${script.id}" registry-center-ref="regCenter" -->
+ <!--sharding-total-count="${script.shardingTotalCount}" cron="${script.cron}" sharding-item-parameters="${script.shardingItemParameters}" description="${script.description}" -->
+ <!--overwrite="${script.overwrite}">-->
<!--<props>-->
<!--<prop key="script.command.line">${script.scriptCommandLine}</prop>-->
<!--</props>-->