-
Notifications
You must be signed in to change notification settings - Fork 766
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into springboot3
- Loading branch information
Showing
8 changed files
with
241 additions
and
6 deletions.
There are no files selected for viewing
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
32 changes: 32 additions & 0 deletions
32
...le-adapter-dubbo/example-adapter-apache-dubbo/example-adapter-apache-dubbo-3.2.10/pom.xml
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.dromara.dynamictp</groupId> | ||
<artifactId>dynamic-tp-example-adapter-apache-dubbo</artifactId> | ||
<version>${revision}</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>dynamic-tp-example-adapter-apache-dubbo-3.2.10</artifactId> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.dubbo</groupId> | ||
<artifactId>dubbo</artifactId> | ||
<version>3.2.10</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.dubbo</groupId> | ||
<artifactId>dubbo-spring-boot-starter</artifactId> | ||
<version>3.2.10</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.alibaba.nacos</groupId> | ||
<artifactId>nacos-client</artifactId> | ||
<version>2.1.0</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
35 changes: 35 additions & 0 deletions
35
...che-dubbo-3.2.10/src/main/java/org/dromara/dynamictp/example/DubboExampleApplication.java
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* 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.dromara.dynamictp.example; | ||
|
||
import org.dromara.dynamictp.core.spring.EnableDynamicTp; | ||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
/** | ||
* @author fabian4 | ||
*/ | ||
@EnableDubbo | ||
@EnableDynamicTp | ||
@SpringBootApplication | ||
public class DubboExampleApplication { | ||
public static void main(String[] args) { | ||
SpringApplication.run(DubboExampleApplication.class, args); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
...e-dubbo-3.2.10/src/main/java/org/dromara/dynamictp/example/controller/TestController.java
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* 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.dromara.dynamictp.example.controller; | ||
|
||
import org.dromara.dynamictp.example.dubbo.DubboUserService; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import javax.annotation.Resource; | ||
|
||
/** | ||
* @author fabian4 | ||
*/ | ||
@Slf4j | ||
@RestController | ||
@SuppressWarnings("all") | ||
public class TestController { | ||
|
||
@Resource | ||
private DubboUserService dubboUserService; | ||
|
||
@GetMapping("/dtp-example-adapter/testDubbo") | ||
public String testDubbo() throws InterruptedException { | ||
return dubboUserService.getUserName(1001); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...ache-dubbo-3.2.10/src/main/java/org/dromara/dynamictp/example/dubbo/DubboUserService.java
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* 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.dromara.dynamictp.example.dubbo; | ||
|
||
/** | ||
* DubboUserService related | ||
* | ||
* @author kyao | ||
* @since 1.1.6 | ||
**/ | ||
public interface DubboUserService { | ||
|
||
String getUserName(long id); | ||
} |
35 changes: 35 additions & 0 deletions
35
...-dubbo-3.2.10/src/main/java/org/dromara/dynamictp/example/dubbo/DubboUserServiceImpl.java
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* 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.dromara.dynamictp.example.dubbo; | ||
|
||
import org.apache.dubbo.config.annotation.DubboService; | ||
|
||
/** | ||
* DubboUserServiceImpl related | ||
* | ||
* @author kyao | ||
* @since 1.1.6 | ||
**/ | ||
@DubboService | ||
public class DubboUserServiceImpl implements DubboUserService { | ||
|
||
@Override | ||
public String getUserName(long id) { | ||
return "kyao"; | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
...apter-apache-dubbo/example-adapter-apache-dubbo-3.2.10/src/main/resources/application.yml
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
server: | ||
port: 9102 | ||
|
||
spring: | ||
application: | ||
name: dynamic-tp-adapter-dubbo-demo | ||
|
||
dynamic: | ||
tp: | ||
enabled: true | ||
enabledCollect: true # 是否开启监控指标采集,默认false | ||
collectorTypes: logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer | ||
monitorInterval: 5 | ||
platforms: # 通知报警平台配置 | ||
- platform: ding | ||
urlKey: f80dad441fcd655438f4a08dcd6a # 替换 | ||
secret: SECb5441fa6f375d5b9d21 # 替换,非sign模式可以没有此值 | ||
receivers: 15810119805 # 钉钉账号手机号 | ||
- platform: lark | ||
urlKey: 0d944ae7-b24a-40 # 替换 | ||
receivers: test1,test2 # 接受人飞书名称/openid | ||
dubboTp: # dubbo 线程池配置 | ||
- threadPoolName: dubboTp#20880 # 名称规则:dubboTp + "#" + 协议端口 | ||
threadPoolAliasName: 测试线程池 | ||
corePoolSize: 100 | ||
maximumPoolSize: 200 | ||
keepAliveTime: 60 | ||
notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警) | ||
- type: capacity # 报警项类型,查看源码 NotifyTypeEnum枚举类 | ||
enabled: true | ||
threshold: 80 # 报警阈值 | ||
platforms: [ ding ] # 可选配置,不配置默认拿上层platforms配置的所以平台 | ||
interval: 120 # 报警间隔(单位:s) | ||
|
||
dubbo: | ||
application: | ||
name: dynamic-tp-adapter-demo | ||
registry: | ||
address: nacos://127.0.0.1:8848 | ||
protocol: | ||
name: dubbo | ||
port: 20880 | ||
|
||
|
||
# 开启 SpringBoot Actuator Endpoint 暴露出DynamicTp指标接口 | ||
# 开启 prometheus 指标采集端点 | ||
management: | ||
metrics: | ||
export: | ||
prometheus: | ||
enabled: true | ||
endpoints: | ||
web: | ||
exposure: | ||
include: '*' # 测试使用,线上不要用*,按需开启 |
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