-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add event trace spring boot starter usage document
- Loading branch information
Showing
2 changed files
with
81 additions
and
4 deletions.
There are no files selected for viewing
42 changes: 40 additions & 2 deletions
42
...content/user-manual/elasticjob-lite/usage/event-trace/spring-boot-starter.cn.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,45 @@ | ||
+++ | ||
title = "Spring Boot Starter" | ||
title = "使用 Spring Boot Starter" | ||
weight = 2 | ||
chapter = true | ||
+++ | ||
|
||
TODO | ||
ElasticJob-Lite 提供了自动配置 TracingConfiguration 的 Tracing Spring Boot Starter, | ||
开发者只需注册一个 DataSource 到 Spring 容器中, | ||
Starter 就会自动创建一个 TracingConfiguration 并注册到 Spring 容器中。 | ||
|
||
## 引入 elasticjob-tracing-spring-boot-starter | ||
|
||
```xml | ||
<dependency> | ||
<groupId>org.apache.shardingsphere.elasticjob</groupId> | ||
<artifactId>elasticjob-tracing-spring-boot-starter</artifactId> | ||
<version>${elasticjob.latest.version}</version> | ||
</dependency> | ||
``` | ||
|
||
## 借助 spring-boot-starter-jdbc 注册 DataSource | ||
|
||
引入依赖: | ||
```xml | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-jdbc</artifactId> | ||
<version>${springboot.version}</version> | ||
</dependency> | ||
``` | ||
|
||
配置 DataSource: | ||
```yaml | ||
spring: | ||
datasource: | ||
url: jdbc:h2:mem:job_event_storage | ||
driver-class-name: org.h2.Driver | ||
username: sa | ||
password: | ||
``` | ||
|
||
## 使用 | ||
|
||
TracingConfiguration 会自动注册到容器中,如果与 elasticjob-lite-spring-boot-starter 配合使用, | ||
开发者无需进行其他额外的操作,作业启动器会自动使用创建的 TracingConfiguration。 |
43 changes: 41 additions & 2 deletions
43
...content/user-manual/elasticjob-lite/usage/event-trace/spring-boot-starter.en.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,46 @@ | ||
+++ | ||
title = "Spring Boot Starter" | ||
title = "Use Spring Boot Starter" | ||
weight = 2 | ||
chapter = true | ||
+++ | ||
|
||
TODO | ||
ElasticJob-Lite provides a Spring Boot Starter to configure TracingConfiguration automatically. | ||
What developers need to do is register a bean of DataSource into the Spring IoC Container. | ||
Then the Starter will create an instance of TracingConfiguration and register it into the container. | ||
|
||
## Introduce elasticjob-tracing-spring-boot-starter dependency | ||
|
||
```xml | ||
<dependency> | ||
<groupId>org.apache.shardingsphere.elasticjob</groupId> | ||
<artifactId>elasticjob-tracing-spring-boot-starter</artifactId> | ||
<version>${elasticjob.latest.version}</version> | ||
</dependency> | ||
``` | ||
|
||
## Register DataSource via spring-boot-starter-jdbc | ||
|
||
Introduce dependency: | ||
```xml | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-jdbc</artifactId> | ||
<version>${springboot.version}</version> | ||
</dependency> | ||
``` | ||
|
||
Configure DataSource: | ||
```yaml | ||
spring: | ||
datasource: | ||
url: jdbc:h2:mem:job_event_storage | ||
driver-class-name: org.h2.Driver | ||
username: sa | ||
password: | ||
``` | ||
|
||
## Usage | ||
|
||
TracingConfiguration will be registered into the IoC container imperceptibly. | ||
If elasticjob-lite-spring-boot-starter was introduced, developers need to do nothing else. | ||
The instances of JobBootstrap will use the TracingConfiguration automatically. |