apollo 配置中心动态刷新线程池配置完善.

pull/140/head
chen.ma 2 years ago
parent 97ac5a7596
commit c808de32a0

@ -43,6 +43,18 @@
<artifactId>hippo4j-core-spring-boot-starter</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>com.ctrip.framework.apollo</groupId>
<artifactId>apollo-client</artifactId>
<version>1.3.0</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-context</artifactId>
<version>2.2.5.RELEASE</version>
</dependency>
</dependencies>
</project>

@ -1,9 +1,11 @@
package cn.hippo4j.example.core.apollo;
import cn.hippo4j.core.enable.EnableDynamicThreadPool;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@EnableDynamicThreadPool
@SpringBootApplication(scanBasePackages = "cn.hippo4j.example.core")
public class Hippo4jCoreApolloExampleApplication {
public static void main(String[] args) {

@ -1,45 +0,0 @@
server:
port: 8090
servlet:
context-path: /example
spring:
profiles:
active: dev
application:
name: dynamic-threadpool-example
dynamic:
thread-pool:
enable: true
banner: true
check-state-interval: 3
notify-platforms:
- platform: 'WECHAT'
secret-key: 1d307bfa-815f-4662-a2e5-99415e947bb8
- platform: 'DING'
secret-key: 56417ebba6a27ca352f0de77a2ae9da66d01f39610b5ee8a6033c60ef9071c55
apollo:
namespace: xxxx
config-file-type: yml
executors:
- thread-pool-id: 'message-consume'
core-pool-size: 1
maximum-pool-size: 1
queue-capacity: 1
execute-time-out: 1000
blocking-queue: 'LinkedBlockingQueue'
rejected-handler: 'AbortPolicy'
keep-alive-time: 6691
allow-core-thread-time-out: true
thread-name-prefix: 'message-consume'
notify:
is-alarm: true
active-alarm: 80
capacity-alarm: 80
interval: 8
receives:
WECHAT: 'xxx' # Fill in the enterprise weChat userId
DING: 'xxx' # phone

@ -0,0 +1,44 @@
# Configuration reference: https://hippox.cn/pages/2f674h
server.port=8091
server.servlet.context-path=/example
app.id=dynamic-threadpool-example
apollo.meta=http://127.0.0.1:8080
apollo.autoUpdateInjectedSpringProperties=true
apollo.bootstrap.enabled=true
apollo.bootstrap.namespaces=application
apollo.bootstrap.eagerLoad.enabled=true
spring.profiles.active=dev
spring.application.name=dynamic-threadpool-example
spring.dynamic.thread-pool.enable=true
spring.dynamic.thread-pool.banner=true
spring.dynamic.thread-pool.check-state-interval=3
spring.dynamic.thread-pool.notify-platforms[0].platform=WECHAT
spring.dynamic.thread-pool.notify-platforms[0].secret-key=ac0426a5-c712-474c-9bff-72b8b8f5caff
spring.dynamic.thread-pool.notify-platforms[1].platform=DING
spring.dynamic.thread-pool.notify-platforms[1].secret-key=56417ebba6a27ca352f0de77a2ae9da66d01f39610b5ee8a6033c60ef9071c55
spring.dynamic.thread-pool.notify-platforms[2].platform=LARK
spring.dynamic.thread-pool.notify-platforms[2].secret-key=2cbf2808-3839-4c26-a04d-fd201dd51f9e
spring.dynamic.thread-pool.apollo.namespace=application
spring.dynamic.thread-pool.config-file-type=properties
spring.dynamic.thread-pool.executors[0].thread-pool-id=message-consume
spring.dynamic.thread-pool.executors[0].core-pool-size=3
spring.dynamic.thread-pool.executors[0].maximum-pool-size=4
spring.dynamic.thread-pool.executors[0].queue-capacity=4
spring.dynamic.thread-pool.executors[0].execute-time-out=1000
spring.dynamic.thread-pool.executors[0].blocking-queue=LinkedBlockingQueue
spring.dynamic.thread-pool.executors[0].rejected-handler=AbortPolicy
spring.dynamic.thread-pool.executors[0].keep-alive-time=1000
spring.dynamic.thread-pool.executors[0].allow-core-thread-time-out=true
spring.dynamic.thread-pool.executors[0].thread-name-prefix=message-consume
spring.dynamic.thread-pool.executors[0].notify.is-alarm=true
spring.dynamic.thread-pool.executors[0].notify.active-alarm=80
spring.dynamic.thread-pool.executors[0].notify.capacity-alarm=80
spring.dynamic.thread-pool.executors[0].notify.interval=8
spring.dynamic.thread-pool.executors[0].notify.receives.WECHAT=xxx
spring.dynamic.thread-pool.executors[0].notify.receives.DING=xxx

@ -4,7 +4,7 @@ import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class Hippo4jCoreApolloSpringBootStarterExampleApplicationTests {
class Hippo4jCoreApolloExampleApplicationTests {
@Test
void contextLoads() {

@ -4,7 +4,7 @@ import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class Hippo4jCoreExampleApplicationTests {
class Hippo4jCoreNacosExampleApplicationTests {
@Test
void contextLoads() {
Loading…
Cancel
Save