# Dubbo Spring Boot Production-Ready
`dubbo-spring-boot-actuator` provides production-ready features (e.g. [health checks](#health-checks), [endpoints](#endpoints), and [externalized configuration](#externalized-configuration)).
## Content
1. [Main Content](https://github.com/dubbo/dubbo-spring-boot-project)
2. [Integrate with Maven](#integrate-with-maven)
3. [Health Checks](#health-checks)
4. [Endpoints](#endpoints)
5. [Externalized Configuration](#externalized-configuration)
## Integrate with Maven
You can introduce the latest `dubbo-spring-boot-actuator` to your project by adding the following dependency to your pom.xml
```xml
<dependency>
<groupId>com.alibaba.boot</groupId>
<artifactId>dubbo-spring-boot-actuator</artifactId>
<version>0.1.0</version>
</dependency>
```
If your project failed to resolve the dependency, try to add the following repository:
```xml
<repositories>
<repository>
<id>sonatype-nexus-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
```
## Health Checks
`dubbo-spring-boot-actuator` supports the standard Spring Boot `HealthIndicator` as a production-ready feature , which will be aggregated into Spring Boot's `Health` and exported on `HealthEndpoint` that works MVC (Spring Web MVC) and JMX (Java Management Extensions) both if they are available.
### MVC Endpoint : `/health`
Suppose a Spring Boot Web application did not specify `management.port`, you can access http://localhost:8080/health via Web Client and will get a response with JSON format is like below :
```json
{
"status": "UP",
"dubbo": {
"status": "UP",
"memory": {
"source": "management.health.dubbo.status.defaults",
"status": {
"level": "OK",
"message": "max:3641M,total:383M,used:92M,free:291M",
"description": null
}
},
"load": {
"source": "management.health.dubbo.status.extras",
"status": {
"level": "OK",
"message": "load:1.73583984375,cpu:8",
"description": null
}
},
"threadpool": {
"source": "management.health.dubbo.status.extras",
"status": {
"level": "OK",
"message": "Pool status:OK, max:200, core:200, largest:0, active:0, task:0, service port: 12345",
"description": null
}
},
"server": {
"source": "dubbo@ProtocolConfig.getStatus()",
"status": {
"level": "OK",
"message": "/192.168.1.103:12345(clients:0)",
"description": null
}
}
}
// ignore others
}
```
In [samples](../dubbo-spring-boot-samples/) , `/health` MVC Endpoints are exposed on http://localhost:9091/health ([provider](../dubbo-spring-boot-samples/dubbo-spring-boot-sample-provider)) and http://localhost:8081/health ([consumer](../dubbo-spring-boot-samples/dubbo-spring-boot-sample-consumer))
`memory`, `load`, `threadpool` and `server` are Dubbo's build-in `StatusChecker`s in above example. Dubbo allows the application to extend `StatusChecker`'s SPI.
Default , `memory` and `load` will be added into Dubbo's `HealthIndicator` , it could be overridden by externalized configuration [`StatusChecker`'s defaults](#statuschecker-defaults).
### JMX Endpoint : `healthEndpoint`
`healthEndpoint` is a JMX (Java Management Extensions) Endpoint with ObjectName `org.springframework.boot:type=Endpoint,name=healthEndpoint` , it can be managed by JMX agent ,e.g. JDK tools : `jconsole` and so on.
![](JMX_HealthEndpoint.png)
### Build-in `StatusChecker`s
`META-INF/dubbo/internal/com.alibaba.dubbo.common.status.StatusChecker` declares Build-in `StatusChecker`s as follow :
```properties
registry=com.alibaba.dubbo.registry.status.RegistryStatusChecker
spring=com.alibaba.dubbo.config.spring.status.SpringStatusChecker
datasource=com.alibaba.dubbo.config.spring.status.DataSourceStatusChecker
memory=com.alibaba.dubbo.common.status.support.MemoryStatusChecker
load=com.alibaba.dubbo.common.status.support.LoadStatusChecker
server=com.alibaba.dubbo.rpc.protocol.dubbo.status.ServerStatusChecker
threadpool=com.alibaba.dubbo.rpc.protocol.dubbo.status.ThreadPoolStatusChecker
```
The property key that is name of `StatusChecker` can be a valid value of `management.health.dubbo.status.*` in externalized configuration.
## Endpoints
Actuator endpoint `dubbo` supports Spring Web MVC Endpoints :
| URI | HTTP Method | Description | Content Type |
| ------------------- | ----------- | ----------------------------------- | ------------------ |
| `/dubbo` | `GET` | Exposes Dubbo's meta data | `application/json` |
| `/dubbo/properties` | `GET` | Exposes all Dubbo's Properties | `application/json` |
| `/dubbo/services` | `GET` | Exposes all Dubbo's `ServiceBean` | `application/json` |
| `/dubbo/references` | `GET` | Exposes all Dubbo's `ReferenceBean` | `application/json` |
| `/dubbo/configs` | `GET` | Exposes all Dubbo's `*Config` | `application/json` |
| `/dubbo/shutdown` | `POST` | Shutdown Dubbo services | `application/json` |
### Endpoint : `/dubbo`
`/dubbo` exposes Dubbo's meta data :
```json
{
"timestamp": 1516623290166,
"versions": {
"dubbo-spring-boot": "1.0.0"
"dubbo": "2.5.9"
},
"urls": {
"dubbo": "https://github.com/alibaba/dubbo",
"google-group": "http://groups.google.com/group/dubbo",
"github": "https://github.com/dubbo/dubbo-spring-boot-project",
"issues": "https://github.com/dubbo/dubbo-spring-boot-project/issues",
"git": "https://github.com/dubbo/dubbo-spring-boot-project.git"
},
"endpoints": {
"shutdown": "/shutdown",
"configs": "/configs",
"services": "/services",
"references": "/references",
"properties": "/properties"
}
}
```
### Endpoint : `/dubbo/properties`
`/dubbo/properties` exposes all Dubbo's Properties from Spring Boot Externalized Configuration (a.k.a `PropertySources`) :
```json
{
"dubbo.application.id": "dubbo-provider-demo",
"dubbo.application.name": "dubbo-provider-demo",
"dubbo.application.qos-enable": "false",
"dubbo.application.qos-port": "33333",
"dubbo.protocol.id": "dubbo",
"dubbo.protocol.name": "dubbo",
"dubbo.protocol.port": "12345",
"dubbo.registry.address": "N/A",
"dubbo.registry.id": "my-registry",
"dubbo.scan.basePackages": "com.alibaba.boot.dubbo.demo.provider.service"
}
```
The structure of JSON is simple Key-Value format , the key is property name as and the value is property value.
### Endpoint : `/dubbo/services`
`/dubbo/services` exposes all Dubbo's `ServiceBean` that are declared via `<dubbo:service/>` or `@Service` present in Spring `ApplicationContext` :
```json
{
"ServiceBean@com.alibaba.boot.dubbo.demo.api.DemoService#defaultDemoService": {
"accesslog": null,
"actives": null,
"cache": null,
"callbacks": null,
"class": "com.alibaba.dubbo.config.spring.ServiceBean",
"cluster": null,
"connections": null,
"delay": null,
"document": null,
"executes": null,
"export": null,
"exported": true,
"filter": "",
"generic": "false",
"group": null,
"id": "com.alibaba.boot.dubbo.demo.api.DemoService",
"interface": "com.alibaba.boot.dubbo.demo.api.DemoService",
"interfaceClass": "com.alibaba.boot.dubbo.demo.api.DemoService",
"layer": null,
"listener": "",
"loadbalance": null,
"local": null,
"merger": null,
"mock": null,
"onconnect": null,
"ondisconnect": null,
"owner": null,
"path": "com.alibaba.boot.dubbo.demo.api.DemoService",
"proxy": null,
"retries": null,
"scope": null,
"sent": null,
"stub": null,
"timeout": null,
"token"
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
dubbo-spring-boot-project-master.zip (58个子文件)
dubbo-spring-boot-project-master
.gitignore 448B
dubbo-spring-boot-autoconfigure
src
main
resources
META-INF
spring.factories 322B
java
com
alibaba
boot
dubbo
context
event
OverrideDubboConfigApplicationListener.java 3KB
WelcomeLogoApplicationListener.java 3KB
util
EnvironmentUtils.java 4KB
DubboUtils.java 5KB
autoconfigure
MultipleDubboConfigBindingProperties.java 4KB
DubboAutoConfiguration.java 5KB
DubboScanProperties.java 2KB
DubboConfigProperties.java 2KB
SingleDubboConfigBindingProperties.java 4KB
test
java
com
alibaba
boot
dubbo
context
event
WelcomeLogoApplicationListenerTest.java 2KB
OverrideDubboConfigApplicationListenerTest.java 2KB
OverrideDubboConfigApplicationListenerDisableTest.java 2KB
util
EnvironmentUtilsTest.java 2KB
DubboUtilsTest.java 3KB
autoconfigure
DubboAutoConfigurationOnSingleConfigTest.java 6KB
DubboAutoConfigurationOnMultipleConfigTest.java 10KB
pom.xml 2KB
README.md 7KB
.mvn
wrapper
maven-wrapper.jar 47KB
maven-wrapper.properties 110B
config-popup-window.png 83KB
.travis.yml 79B
mvnw 6KB
LICENSE 11KB
pom.xml 4KB
mvnw.cmd 5KB
README.md 8KB
dubbo-spring-boot-actuator
src
main
resources
META-INF
spring.factories 398B
java
com
alibaba
boot
dubbo
actuate
health
DubboHealthIndicator.java 7KB
DubboHealthIndicatorProperties.java 3KB
endpoint
DubboEndpoint.java 3KB
mvc
DubboMvcEndpoint.java 16KB
autoconfigure
DubboHealthIndicatorAutoConfiguration.java 2KB
DubboMvcEndpointManagementContextConfiguration.java 2KB
DubboEndpointAutoConfiguration.java 2KB
test
java
com
alibaba
boot
dubbo
actuate
health
DubboHealthIndicatorTest.java 3KB
endpoint
mvc
DubboMvcEndpointTest.java 7KB
DubboEndpointTest.java 3KB
JMX_HealthEndpoint.png 278KB
pom.xml 3KB
README.md 14KB
mconfig-popup-window.png 59KB
dubbo-spring-boot-starter
src
main
resources
META-INF
spring.provides 47B
pom.xml 2KB
dubbo-spring-boot-samples
pom.xml 1KB
dubbo-spring-boot-sample-provider
src
main
resources
application.properties 994B
java
com
alibaba
boot
dubbo
demo
provider
bootstrap
DubboProviderDemo.java 1KB
service
DefaultDemoService.java 1KB
pom.xml 2KB
dubbo-spring-boot-sample-api
src
main
java
com
alibaba
boot
dubbo
demo
consumer
DemoService.java 1KB
pom.xml 630B
dubbo-spring-boot-sample-consumer
src
main
resources
application.properties 609B
java
com
alibaba
boot
dubbo
demo
consumer
bootstrap
DubboConsumerDemo.java 1KB
controller
DemoConsumerController.java 2KB
pom.xml 2KB
dubbo-spring-boot-parent
pom.xml 9KB
共 58 条
- 1
资源评论
liang_Henry
- 粉丝: 36
- 资源: 25
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功