You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hippo4j/docs/versioned_docs/version-1.4.3/user_docs/getting_started/hippo4j-adapter.md

2.2 KiB

sidebar_position
6

三方框架线程池适配

Hippo4J 目前已支持的三方框架线程池列表:

  • Dubbo
  • Hystrix
  • RabbitMQ
  • RocketMQ
  • AlibabaDubbo
  • RocketMQSpringCloudStream
  • RabbitMQSpringCloudStream

引入 Hippo4J Server 或 Core 的 Maven Jar 坐标后,还需要引入对应的框架适配 Jar

<dependency>
    <groupId>cn.hippo4j</groupId>
    <!-- Dubbo -->
    <artifactId>hippo4j-spring-boot-starter-adapter-dubbo</artifactId>
    <!-- Alibaba Dubbo -->
    <artifactId>hippo4j-spring-boot-starter-adapter-alibaba-dubbo</artifactId>
    <!-- Hystrix -->
    <artifactId>hippo4j-spring-boot-starter-adapter-hystrix</artifactId>
    <!-- RabbitMQ -->
    <artifactId>hippo4j-spring-boot-starter-adapter-rabbitmq</artifactId>
    <!-- RocketMQ -->
    <artifactId>hippo4j-spring-boot-starter-adapter-rocketmq</artifactId>
    <!-- SpringCloud Stream RocketMQ -->
    <artifactId>hippo4j-spring-boot-starter-adapter-spring-cloud-stream-rocketmq</artifactId>
    <!-- SpringCloud Stream RabbitMQ -->
    <artifactId>hippo4j-spring-boot-starter-adapter-spring-cloud-stream-rabbitmq</artifactId>
    <version>1.4.3-upgrade</version>
</dependency>

如果想省事,仅需引入一个全量包,框架底层会根据条件判断加载具体线程池适配器。

<dependency>
    <groupId>cn.hippo4j</groupId>
    <artifactId>hippo4j-spring-boot-starter-adapter-all</artifactId>
    <version>1.4.3-upgrade</version>
</dependency>

Hippo4J Server

Hippo4J Server 仅需要引入上述 Jar 包,即可在 Hippo4J Server 的控制台进行查看及修改三方框架线程池。

Hippo4J Config

Hippo4J Config 除了依赖上述适配 Jar 包外,还需要在配置中心添加以下配置项。

spring:
  dynamic:
    thread-pool:
      # 省略其它配置
      adapter-executors:
        # threadPoolKey 代表线程池标识
        - threadPoolKey: 'input'
          # mark 为三方线程池框架类型,参见文初已支持框架集合
          mark: 'RocketMQSpringCloudStream'
          corePoolSize: 10
          maximumPoolSize: 10