diff --git a/hippo4j-example/hippo4j-core-apollo-spring-boot-starter-example/pom.xml b/hippo4j-example/hippo4j-core-apollo-spring-boot-starter-example/pom.xml index b0451a9f..6bcdd2ed 100644 --- a/hippo4j-example/hippo4j-core-apollo-spring-boot-starter-example/pom.xml +++ b/hippo4j-example/hippo4j-core-apollo-spring-boot-starter-example/pom.xml @@ -43,6 +43,18 @@ hippo4j-core-spring-boot-starter ${revision} + + + com.ctrip.framework.apollo + apollo-client + 1.3.0 + + + + org.springframework.cloud + spring-cloud-context + 2.2.5.RELEASE + diff --git a/hippo4j-example/hippo4j-core-apollo-spring-boot-starter-example/src/main/java/cn/hippo4j/example/core/apollo/Hippo4jCoreApolloExampleApplication.java b/hippo4j-example/hippo4j-core-apollo-spring-boot-starter-example/src/main/java/cn/hippo4j/example/core/apollo/Hippo4jCoreApolloExampleApplication.java index 29207674..dc803a2a 100644 --- a/hippo4j-example/hippo4j-core-apollo-spring-boot-starter-example/src/main/java/cn/hippo4j/example/core/apollo/Hippo4jCoreApolloExampleApplication.java +++ b/hippo4j-example/hippo4j-core-apollo-spring-boot-starter-example/src/main/java/cn/hippo4j/example/core/apollo/Hippo4jCoreApolloExampleApplication.java @@ -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) { diff --git a/hippo4j-example/hippo4j-core-apollo-spring-boot-starter-example/src/main/resources/application.yaml b/hippo4j-example/hippo4j-core-apollo-spring-boot-starter-example/src/main/resources/application.yaml deleted file mode 100644 index 8b1f1f78..00000000 --- a/hippo4j-example/hippo4j-core-apollo-spring-boot-starter-example/src/main/resources/application.yaml +++ /dev/null @@ -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 - diff --git a/hippo4j-example/hippo4j-core-apollo-spring-boot-starter-example/src/main/resources/bootstrap.properties b/hippo4j-example/hippo4j-core-apollo-spring-boot-starter-example/src/main/resources/bootstrap.properties new file mode 100644 index 00000000..0a7011c7 --- /dev/null +++ b/hippo4j-example/hippo4j-core-apollo-spring-boot-starter-example/src/main/resources/bootstrap.properties @@ -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 diff --git a/hippo4j-example/hippo4j-core-apollo-spring-boot-starter-example/src/test/java/cn/hippo4j/example/core/apollo/Hippo4jCoreApolloSpringBootStarterExampleApplicationTests.java b/hippo4j-example/hippo4j-core-apollo-spring-boot-starter-example/src/test/java/cn/hippo4j/example/core/apollo/Hippo4jCoreApolloExampleApplicationTests.java similarity index 75% rename from hippo4j-example/hippo4j-core-apollo-spring-boot-starter-example/src/test/java/cn/hippo4j/example/core/apollo/Hippo4jCoreApolloSpringBootStarterExampleApplicationTests.java rename to hippo4j-example/hippo4j-core-apollo-spring-boot-starter-example/src/test/java/cn/hippo4j/example/core/apollo/Hippo4jCoreApolloExampleApplicationTests.java index 2acad603..198e3253 100644 --- a/hippo4j-example/hippo4j-core-apollo-spring-boot-starter-example/src/test/java/cn/hippo4j/example/core/apollo/Hippo4jCoreApolloSpringBootStarterExampleApplicationTests.java +++ b/hippo4j-example/hippo4j-core-apollo-spring-boot-starter-example/src/test/java/cn/hippo4j/example/core/apollo/Hippo4jCoreApolloExampleApplicationTests.java @@ -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() { diff --git a/hippo4j-example/hippo4j-core-nacos-spring-boot-starter-example/src/test/java/cn/hippo4j/example/core/nacos/Hippo4jCoreExampleApplicationTests.java b/hippo4j-example/hippo4j-core-nacos-spring-boot-starter-example/src/test/java/cn/hippo4j/example/core/nacos/Hippo4jCoreNacosExampleApplicationTests.java similarity index 80% rename from hippo4j-example/hippo4j-core-nacos-spring-boot-starter-example/src/test/java/cn/hippo4j/example/core/nacos/Hippo4jCoreExampleApplicationTests.java rename to hippo4j-example/hippo4j-core-nacos-spring-boot-starter-example/src/test/java/cn/hippo4j/example/core/nacos/Hippo4jCoreNacosExampleApplicationTests.java index f30fb716..c4ffe606 100644 --- a/hippo4j-example/hippo4j-core-nacos-spring-boot-starter-example/src/test/java/cn/hippo4j/example/core/nacos/Hippo4jCoreExampleApplicationTests.java +++ b/hippo4j-example/hippo4j-core-nacos-spring-boot-starter-example/src/test/java/cn/hippo4j/example/core/nacos/Hippo4jCoreNacosExampleApplicationTests.java @@ -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() {