Merge branch 'develop' into develop

pull/450/head
小马哥 2 years ago committed by GitHub
commit 71c8e8a44c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -43,6 +43,7 @@ public final class Singleton {
return result == null ? null : (T) result; return result == null ? null : (T) result;
} }
/** /**
* Get a singleton object by key. * Get a singleton object by key.
* *

@ -24,7 +24,7 @@ import cn.hippo4j.core.executor.manage.GlobalThreadPoolManage;
import cn.hippo4j.core.executor.support.ThreadPoolBuilder; import cn.hippo4j.core.executor.support.ThreadPoolBuilder;
import cn.hippo4j.core.toolkit.IdentifyUtil; import cn.hippo4j.core.toolkit.IdentifyUtil;
import cn.hippo4j.core.toolkit.TraceContextUtil; import cn.hippo4j.core.toolkit.TraceContextUtil;
import cn.hippo4j.message.service.HippoSendMessageService; import cn.hippo4j.message.service.Hippo4jSendMessageService;
import cn.hippo4j.message.enums.NotifyTypeEnum; import cn.hippo4j.message.enums.NotifyTypeEnum;
import cn.hippo4j.message.service.ThreadPoolNotifyAlarm; import cn.hippo4j.message.service.ThreadPoolNotifyAlarm;
import cn.hippo4j.message.request.AlarmNotifyRequest; import cn.hippo4j.message.request.AlarmNotifyRequest;
@ -51,7 +51,7 @@ import java.util.concurrent.*;
public class ThreadPoolNotifyAlarmHandler implements Runnable, CommandLineRunner { public class ThreadPoolNotifyAlarmHandler implements Runnable, CommandLineRunner {
@NonNull @NonNull
private final HippoSendMessageService hippoSendMessageService; private final Hippo4jSendMessageService hippoSendMessageService;
@Value("${spring.profiles.active:UNKNOWN}") @Value("${spring.profiles.active:UNKNOWN}")
private String active; private String active;

@ -22,8 +22,8 @@ import cn.hippo4j.message.platform.DingSendMessageHandler;
import cn.hippo4j.message.platform.LarkSendMessageHandler; import cn.hippo4j.message.platform.LarkSendMessageHandler;
import cn.hippo4j.message.platform.WeChatSendMessageHandler; import cn.hippo4j.message.platform.WeChatSendMessageHandler;
import cn.hippo4j.message.service.AlarmControlHandler; import cn.hippo4j.message.service.AlarmControlHandler;
import cn.hippo4j.message.service.HippoBaseSendMessageService; import cn.hippo4j.message.service.Hippo4jBaseSendMessageService;
import cn.hippo4j.message.service.HippoSendMessageService; import cn.hippo4j.message.service.Hippo4jSendMessageService;
import cn.hippo4j.message.service.SendMessageHandler; import cn.hippo4j.message.service.SendMessageHandler;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
@ -33,9 +33,9 @@ import org.springframework.context.annotation.Bean;
public class MessageConfiguration { public class MessageConfiguration {
@Bean @Bean
public HippoSendMessageService hippoSendMessageService(NotifyConfigBuilder serverNotifyConfigBuilder, public Hippo4jSendMessageService hippo4jSendMessageService(NotifyConfigBuilder serverNotifyConfigBuilder,
AlarmControlHandler alarmControlHandler) { AlarmControlHandler alarmControlHandler) {
return new HippoBaseSendMessageService(serverNotifyConfigBuilder, alarmControlHandler); return new Hippo4jBaseSendMessageService(serverNotifyConfigBuilder, alarmControlHandler);
} }
@Bean @Bean

@ -22,29 +22,29 @@ import lombok.Builder;
import lombok.Data; import lombok.Data;
/** /**
* Alarm control dto. * Alarm control DTO.
*/ */
@Data @Data
@Builder @Builder
public class AlarmControlDTO { public class AlarmControlDTO {
/** /**
* 线 Id * Thread pool id
*/ */
private String threadPool; private String threadPool;
/** /**
* * Push alarm platform
*/ */
private String platform; private String platform;
/** /**
* * Push Alert Type
*/ */
private NotifyTypeEnum typeEnum; private NotifyTypeEnum typeEnum;
/** /**
* 线 * Build thread pool alarm id
* *
* @return * @return
*/ */

@ -23,7 +23,7 @@ import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
/** /**
* Notify config dto. * Notify config DTO.
*/ */
@Data @Data
@EqualsAndHashCode @EqualsAndHashCode

@ -28,12 +28,12 @@ import java.util.List;
public class ThreadPoolNotifyDTO { public class ThreadPoolNotifyDTO {
/** /**
* notifyKey * Notify key
*/ */
private String notifyKey; private String notifyKey;
/** /**
* notifyList * Notify list
*/ */
private List<NotifyConfigDTO> notifyList; private List<NotifyConfigDTO> notifyList;
} }

@ -23,27 +23,27 @@ package cn.hippo4j.message.platform.constant;
public class DingAlarmConstants { public class DingAlarmConstants {
/** /**
* Url * DingTalk Robot Url
*/ */
public static final String DING_ROBOT_SERVER_URL = "https://oapi.dingtalk.com/robot/send?access_token="; public static final String DING_ROBOT_SERVER_URL = "https://oapi.dingtalk.com/robot/send?access_token=";
/** /**
* 线 * Thread Pool Alert Notification Title
*/ */
public static final String DING_ALARM_TITLE = "动态线程池告警"; public static final String DING_ALARM_TITLE = "动态线程池告警";
/** /**
* 线 * Thread pool parameter change notification title
*/ */
public static final String DING_NOTICE_TITLE = "动态线程池通知"; public static final String DING_NOTICE_TITLE = "动态线程池通知";
/** /**
* Trace * Trace info
*/ */
public static final String DING_ALARM_TIMOUT_TRACE_REPLACE_TXT = "<font color=#708090 size=2>链路信息:%s</font> \n\n "; public static final String DING_ALARM_TIMOUT_TRACE_REPLACE_TXT = "<font color=#708090 size=2>链路信息:%s</font> \n\n ";
/** /**
* * Replace task timeout template
*/ */
public static final String DING_ALARM_TIMOUT_REPLACE_TXT = public static final String DING_ALARM_TIMOUT_REPLACE_TXT =
"<font color=#708090 size=2>任务执行时间:%d / ms </font> \n\n " + "<font color=#708090 size=2>任务执行时间:%d / ms </font> \n\n " +

@ -23,51 +23,24 @@ package cn.hippo4j.message.platform.constant;
public class LarkAlarmConstants { public class LarkAlarmConstants {
/** /**
* lark bot url * Lark bot url
*/ */
public static final String LARK_BOT_URL = "https://open.feishu.cn/open-apis/bot/v2/hook/"; public static final String LARK_BOT_URL = "https://open.feishu.cn/open-apis/bot/v2/hook/";
/** /**
* lark at format. openid * Lark at format. openid
* openid,@ * When openid is configured, the bot can @person
*/ */
public static final String LARK_AT_FORMAT_OPENID = "<at id='%s'></at>"; public static final String LARK_AT_FORMAT_OPENID = "<at id='%s'></at>";
/** /**
* lark at format. username * Lark at format. username
* username,@username,@@ * When configuring username, only @username can be displayed in blue font, and it is reminded by @people without @
*/ */
public static final String LARK_AT_FORMAT_USERNAME = "<at id=''>%s</at>"; public static final String LARK_AT_FORMAT_USERNAME = "<at id=''>%s</at>";
/** /**
* lark openid prefix * Lark openid prefix
*/ */
public static final String LARK_OPENID_PREFIX = "ou_"; public static final String LARK_OPENID_PREFIX = "ou_";
/**
* Trace
*/
public static final String LARK_ALARM_TIMOUT_TRACE_REPLACE_TXT = ",{\"is_short\":true,\"text\":{\"content\":\"** 链路信息:** %s\",\"tag\":\"lark_md\"}}";
/**
*
*/
public static final String LARK_ALARM_TIMOUT_REPLACE_TXT =
"{\"fields\":[{\"is_short\":true,\"text\":{\"content\":\"** 任务执行时间:** %s\",\"tag\":\"lark_md\"}},{\"is_short\":true,\"text\":{\"content\":\"** 超时时间:** %s\",\"tag\":\"lark_md\"}}" +
LARK_ALARM_TIMOUT_TRACE_REPLACE_TXT +
"],\"tag\":\"div\"},{\"tag\":\"hr\"},";
/**
* lark alarm json str
*/
public static final String LARK_ALARM_JSON_STR =
"{\"msg_type\":\"interactive\",\"card\":{\"config\":{\"wide_screen_mode\":true},\"header\":{\"template\":\"red\",\"title\":{\"content\":\"[\uD83D\uDD25警报] %s 动态线程池运行告警(%s\",\"tag\":\"plain_text\"}},\"elements\":[{\"fields\":[{\"is_short\":true,\"text\":{\"content\":\"** 线程池ID** %s\",\"tag\":\"lark_md\"}},{\"is_short\":true,\"text\":{\"content\":\"** 应用名称:** %s\",\"tag\":\"lark_md\"}},{\"is_short\":true,\"text\":{\"content\":\"** 应用实例:** %s\",\"tag\":\"lark_md\"}}],\"tag\":\"div\"},{\"tag\":\"hr\"},{\"fields\":[{\"is_short\":true,\"text\":{\"content\":\"** 核心线程数:** %s\",\"tag\":\"lark_md\"}},{\"is_short\":true,\"text\":{\"content\":\"** 最大线程数:** %s\",\"tag\":\"lark_md\"}},{\"is_short\":true,\"text\":{\"content\":\"** 当前线程数:** %s\",\"tag\":\"lark_md\"}},{\"is_short\":true,\"text\":{\"content\":\"** 活跃线程数:** %s\",\"tag\":\"lark_md\"}},{\"is_short\":true,\"text\":{\"content\":\"** 同存最大线程数:** %s\",\"tag\":\"lark_md\"}},{\"is_short\":true,\"text\":{\"content\":\"** 线程池任务总量:** %s\",\"tag\":\"lark_md\"}}],\"tag\":\"div\"},{\"tag\":\"hr\"},{\"fields\":[{\"is_short\":true,\"text\":{\"content\":\"** 队列类型:** %s\",\"tag\":\"lark_md\"}},{\"is_short\":true,\"text\":{\"content\":\"** 队列容量:** %s\",\"tag\":\"lark_md\"}},{\"is_short\":true,\"text\":{\"content\":\"** 队列元素个数:** %s\",\"tag\":\"lark_md\"}},{\"is_short\":true,\"text\":{\"content\":\"** 队列剩余个数:** %s\",\"tag\":\"lark_md\"}}],\"tag\":\"div\"},{\"tag\":\"hr\"},"
+ LARK_ALARM_TIMOUT_REPLACE_TXT
+ "{\"fields\":[{\"is_short\":true,\"text\":{\"content\":\"** 拒绝策略:** %s\",\"tag\":\"lark_md\"}},{\"is_short\":true,\"text\":{\"content\":\"** 拒绝策略执行次数:** %s\",\"tag\":\"lark_md\"}},{\"is_short\":true,\"text\":{\"content\":\"** OWNER** %s\",\"tag\":\"lark_md\"}},{\"is_short\":true,\"text\":{\"content\":\"** 播报时间: ** %s\",\"tag\":\"lark_md\"}}],\"tag\":\"div\"},{\"tag\":\"hr\"},{\"tag\":\"note\",\"elements\":[{\"tag\":\"plain_text\",\"content\":\"提示: %s 分钟内此线程池不会重复告警(可配置)\"}]}]}}";
/**
* lark notice json str
*/
public static final String LARK_NOTICE_JSON_STR =
"{\"msg_type\":\"interactive\",\"card\":{\"config\":{\"wide_screen_mode\":true},\"header\":{\"template\":\"greed\",\"title\":{\"content\":\"[通知] %s 动态线程池参数变更\",\"tag\":\"plain_text\"}},\"elements\":[{\"fields\":[{\"is_short\":true,\"text\":{\"content\":\"** 线程池ID** %s\",\"tag\":\"lark_md\"}},{\"is_short\":true,\"text\":{\"content\":\"** 应用名称:** %s\",\"tag\":\"lark_md\"}},{\"is_short\":true,\"text\":{\"content\":\"** 应用实例:** %s\",\"tag\":\"lark_md\"}}],\"tag\":\"div\"},{\"tag\":\"hr\"},{\"fields\":[{\"is_short\":true,\"text\":{\"content\":\"** 核心线程数:** %s\",\"tag\":\"lark_md\"}},{\"is_short\":true,\"text\":{\"content\":\"** 最大线程数:** %s\",\"tag\":\"lark_md\"}},{\"is_short\":true,\"text\":{\"content\":\"** 核心线程超时:** %s\",\"tag\":\"lark_md\"}},{\"is_short\":true,\"text\":{\"content\":\"** 线程存活时间:** %s\",\"tag\":\"lark_md\"}}],\"tag\":\"div\"},{\"tag\":\"hr\"},{\"fields\":[{\"is_short\":true,\"text\":{\"content\":\"** 队列类型:** %s\",\"tag\":\"lark_md\"}},{\"is_short\":true,\"text\":{\"content\":\"** 队列容量:** %s\",\"tag\":\"lark_md\"}},{\"is_short\":true,\"text\":{\"content\":\"** 执行超时时间:** %s\",\"tag\":\"lark_md\"}}],\"tag\":\"div\"},{\"tag\":\"hr\"},{\"fields\":[{\"is_short\":true,\"text\":{\"content\":\"** AGO 拒绝策略:** %s\",\"tag\":\"lark_md\"}},{\"is_short\":true,\"text\":{\"content\":\"** NOW 拒绝策略:** %s\",\"tag\":\"lark_md\"}},{\"is_short\":true,\"text\":{\"content\":\"** OWNER** %s\",\"tag\":\"lark_md\"}},{\"is_short\":true,\"text\":{\"content\":\"** 播报时间: ** %s\",\"tag\":\"lark_md\"}}],\"tag\":\"div\"},{\"tag\":\"hr\"},{\"tag\":\"note\",\"elements\":[{\"tag\":\"plain_text\",\"content\":\"提示:动态线程池配置变更实时通知(无限制)\"}]}]}}";
} }

@ -23,17 +23,17 @@ package cn.hippo4j.message.platform.constant;
public class WeChatAlarmConstants { public class WeChatAlarmConstants {
/** /**
* Url * Enterprise Micro Robot Url
*/ */
public static final String WE_CHAT_SERVER_URL = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key="; public static final String WE_CHAT_SERVER_URL = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=";
/** /**
* Trace * Trace info
*/ */
public static final String WE_CHAT_ALARM_TIMOUT_TRACE_REPLACE_TXT = "\n> 链路信息:%s "; public static final String WE_CHAT_ALARM_TIMOUT_TRACE_REPLACE_TXT = "\n> 链路信息:%s ";
/** /**
* * Replace task timeout template
*/ */
public static final String WE_CHAT_ALARM_TIMOUT_REPLACE_TXT = public static final String WE_CHAT_ALARM_TIMOUT_REPLACE_TXT =
"\n> 任务执行时间:%s / ms \n" + "\n> 任务执行时间:%s / ms \n" +

@ -30,102 +30,102 @@ import lombok.experimental.Accessors;
public class AlarmNotifyRequest extends BaseNotifyRequest { public class AlarmNotifyRequest extends BaseNotifyRequest {
/** /**
* interval * Interval
*/ */
private Integer interval; private Integer interval;
/** /**
* notifyTypeEnum * Notify type enum
*/ */
private NotifyTypeEnum notifyTypeEnum; private NotifyTypeEnum notifyTypeEnum;
/** /**
* active * Active
*/ */
private String active; private String active;
/** /**
* appName * App name
*/ */
private String appName; private String appName;
/** /**
* identify * Identify
*/ */
private String identify; private String identify;
/** /**
* corePoolSize * Core pool size
*/ */
private Integer corePoolSize; private Integer corePoolSize;
/** /**
* maximumPoolSize * Maximum pool size
*/ */
private Integer maximumPoolSize; private Integer maximumPoolSize;
/** /**
* poolSize * Pool size
*/ */
private Integer poolSize; private Integer poolSize;
/** /**
* activeCount * Active count
*/ */
private Integer activeCount; private Integer activeCount;
/** /**
* largestPoolSize * Largest pool size
*/ */
private Integer largestPoolSize; private Integer largestPoolSize;
/** /**
* completedTaskCount * Completed task count
*/ */
private Long completedTaskCount; private Long completedTaskCount;
/** /**
* queueName * Queue name
*/ */
private String queueName; private String queueName;
/** /**
* capacity * Capacity
*/ */
private Integer capacity; private Integer capacity;
/** /**
* queueSize * Queue size
*/ */
private Integer queueSize; private Integer queueSize;
/** /**
* remainingCapacity * Remaining capacity
*/ */
private Integer remainingCapacity; private Integer remainingCapacity;
/** /**
* rejectedExecutionHandlerName * Rejected execution handler name
*/ */
private String rejectedExecutionHandlerName; private String rejectedExecutionHandlerName;
/** /**
* rejectCountNum * Reject count num
*/ */
private Long rejectCountNum; private Long rejectCountNum;
/** /**
* executeTime * Execute time
*/ */
private Long executeTime; private Long executeTime;
/** /**
* executeTimeOut * Execute timeout
*/ */
private Long executeTimeOut; private Long executeTimeOut;
/** /**
* executeTimeoutTrace * Execute timeout trace
*/ */
private String executeTimeoutTrace; private String executeTimeoutTrace;
} }

@ -26,7 +26,7 @@ import lombok.Data;
public class RobotAlarmNotifyRequest extends AlarmNotifyRequest { public class RobotAlarmNotifyRequest extends AlarmNotifyRequest {
/** /**
* secretKey * Secret key
*/ */
private String secretKey; private String secretKey;
} }

@ -26,7 +26,7 @@ import lombok.Data;
public class RobotChangeParameterNotifyRequest extends ChangeParameterNotifyRequest { public class RobotChangeParameterNotifyRequest extends ChangeParameterNotifyRequest {
/** /**
* secretKey * Secret key
*/ */
private String secretKey; private String secretKey;
} }

@ -30,7 +30,7 @@ import java.util.List;
public class ThreadPoolNotifyRequest { public class ThreadPoolNotifyRequest {
/** /**
* groupKeys * Group keys
*/ */
private List<String> groupKeys; private List<String> groupKeys;
} }

@ -26,32 +26,32 @@ import lombok.Data;
public class BaseNotifyRequest implements NotifyRequest { public class BaseNotifyRequest implements NotifyRequest {
/** /**
* tenantId * Tenant id
*/ */
private String tenantId; private String tenantId;
/** /**
* itemId * Item id
*/ */
private String itemId; private String itemId;
/** /**
* threadPoolId * Thread pool id
*/ */
private String threadPoolId; private String threadPoolId;
/** /**
* platform * Platform
*/ */
private String platform; private String platform;
/** /**
* type * Type
*/ */
private String type; private String type;
/** /**
* receives * Receives
*/ */
private String receives; private String receives;
} }

@ -36,11 +36,11 @@ import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* Hippo base send message service. * Hippo-4j base send message service.
*/ */
@Slf4j @Slf4j
@RequiredArgsConstructor @RequiredArgsConstructor
public class HippoBaseSendMessageService implements HippoSendMessageService, CommandLineRunner { public class Hippo4jBaseSendMessageService implements Hippo4jSendMessageService, CommandLineRunner {
private final NotifyConfigBuilder notifyConfigBuilder; private final NotifyConfigBuilder notifyConfigBuilder;

@ -22,12 +22,12 @@ import cn.hippo4j.message.request.AlarmNotifyRequest;
import cn.hippo4j.message.request.ChangeParameterNotifyRequest; import cn.hippo4j.message.request.ChangeParameterNotifyRequest;
/** /**
* Hippo4j send message service. * Hippo-4j send message service.
*/ */
public interface HippoSendMessageService { public interface Hippo4jSendMessageService {
/** /**
* Send alarm message. * Send dynamic thread pool alert notifications.
* *
* @param typeEnum * @param typeEnum
* @param alarmNotifyRequest * @param alarmNotifyRequest
@ -35,7 +35,7 @@ public interface HippoSendMessageService {
void sendAlarmMessage(NotifyTypeEnum typeEnum, AlarmNotifyRequest alarmNotifyRequest); void sendAlarmMessage(NotifyTypeEnum typeEnum, AlarmNotifyRequest alarmNotifyRequest);
/** /**
* Send change message. * Send dynamic thread pool parameter change notification.
* *
* @param changeParameterNotifyRequest * @param changeParameterNotifyRequest
*/ */

@ -63,9 +63,7 @@ public class ThreadPoolNotifyAlarm {
/** /**
* Receives * Receives
* *
* <p> * <p> Do not enable this configuration for the time being, it may be useful if you develop mailboxes in the future.
* Do not enable this configuration for the time being, it may be useful if you develop mailboxes in the future.
* </p>
*/ */
@Deprecated @Deprecated
private Map<String, String> receives; private Map<String, String> receives;

@ -33,8 +33,8 @@ import cn.hippo4j.core.springboot.starter.support.ThreadPoolAdapterRegister;
import cn.hippo4j.message.api.NotifyConfigBuilder; import cn.hippo4j.message.api.NotifyConfigBuilder;
import cn.hippo4j.message.config.MessageConfiguration; import cn.hippo4j.message.config.MessageConfiguration;
import cn.hippo4j.message.service.AlarmControlHandler; import cn.hippo4j.message.service.AlarmControlHandler;
import cn.hippo4j.message.service.HippoBaseSendMessageService; import cn.hippo4j.message.service.Hippo4jBaseSendMessageService;
import cn.hippo4j.message.service.HippoSendMessageService; import cn.hippo4j.message.service.Hippo4jSendMessageService;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration; import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
@ -78,7 +78,7 @@ public class DynamicThreadPoolCoreAutoConfiguration {
} }
@Bean @Bean
public ThreadPoolNotifyAlarmHandler threadPoolNotifyAlarmHandler(HippoSendMessageService hippoSendMessageService) { public ThreadPoolNotifyAlarmHandler threadPoolNotifyAlarmHandler(Hippo4jSendMessageService hippoSendMessageService) {
return new ThreadPoolNotifyAlarmHandler(hippoSendMessageService); return new ThreadPoolNotifyAlarmHandler(hippoSendMessageService);
} }
@ -96,7 +96,7 @@ public class DynamicThreadPoolCoreAutoConfiguration {
@SuppressWarnings("all") @SuppressWarnings("all")
public ExecutorsListener hippo4jExecutorsListener(ThreadPoolNotifyAlarmHandler threadPoolNotifyAlarmHandler, public ExecutorsListener hippo4jExecutorsListener(ThreadPoolNotifyAlarmHandler threadPoolNotifyAlarmHandler,
CoreNotifyConfigBuilder coreNotifyConfigBuilder, CoreNotifyConfigBuilder coreNotifyConfigBuilder,
HippoBaseSendMessageService hippoBaseSendMessageService) { Hippo4jBaseSendMessageService hippoBaseSendMessageService) {
return new ExecutorsListener(threadPoolNotifyAlarmHandler, coreNotifyConfigBuilder, hippoBaseSendMessageService); return new ExecutorsListener(threadPoolNotifyAlarmHandler, coreNotifyConfigBuilder, hippoBaseSendMessageService);
} }

@ -33,7 +33,7 @@ import cn.hippo4j.core.springboot.starter.notify.CoreNotifyConfigBuilder;
import cn.hippo4j.core.springboot.starter.support.GlobalCoreThreadPoolManage; import cn.hippo4j.core.springboot.starter.support.GlobalCoreThreadPoolManage;
import cn.hippo4j.message.dto.NotifyConfigDTO; import cn.hippo4j.message.dto.NotifyConfigDTO;
import cn.hippo4j.message.request.ChangeParameterNotifyRequest; import cn.hippo4j.message.request.ChangeParameterNotifyRequest;
import cn.hippo4j.message.service.HippoBaseSendMessageService; import cn.hippo4j.message.service.Hippo4jBaseSendMessageService;
import cn.hippo4j.message.service.ThreadPoolNotifyAlarm; import cn.hippo4j.message.service.ThreadPoolNotifyAlarm;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -65,7 +65,7 @@ public class ExecutorsListener implements ApplicationListener<Hippo4jCoreDynamic
private final CoreNotifyConfigBuilder coreNotifyConfigBuilder; private final CoreNotifyConfigBuilder coreNotifyConfigBuilder;
private final HippoBaseSendMessageService hippoBaseSendMessageService; private final Hippo4jBaseSendMessageService hippo4jBaseSendMessageService;
@Override @Override
public void onApplicationEvent(Hippo4jCoreDynamicRefreshEvent threadPoolDynamicRefreshEvent) { public void onApplicationEvent(Hippo4jCoreDynamicRefreshEvent threadPoolDynamicRefreshEvent) {
@ -141,7 +141,7 @@ public class ExecutorsListener implements ApplicationListener<Hippo4jCoreDynamic
boolean checkNotifyAlarm = false; boolean checkNotifyAlarm = false;
List<String> changeKeys = Lists.newArrayList(); List<String> changeKeys = Lists.newArrayList();
Map<String, List<NotifyConfigDTO>> newDynamicThreadPoolNotifyMap = coreNotifyConfigBuilder.buildSingleNotifyConfig(properties); Map<String, List<NotifyConfigDTO>> newDynamicThreadPoolNotifyMap = coreNotifyConfigBuilder.buildSingleNotifyConfig(properties);
Map<String, List<NotifyConfigDTO>> notifyConfigs = hippoBaseSendMessageService.getNotifyConfigs(); Map<String, List<NotifyConfigDTO>> notifyConfigs = hippo4jBaseSendMessageService.getNotifyConfigs();
if (CollectionUtil.isNotEmpty(notifyConfigs)) { if (CollectionUtil.isNotEmpty(notifyConfigs)) {
for (Map.Entry<String, List<NotifyConfigDTO>> each : newDynamicThreadPoolNotifyMap.entrySet()) { for (Map.Entry<String, List<NotifyConfigDTO>> each : newDynamicThreadPoolNotifyMap.entrySet()) {
if (checkNotifyConfig) { if (checkNotifyConfig) {
@ -159,7 +159,7 @@ public class ExecutorsListener implements ApplicationListener<Hippo4jCoreDynamic
} }
if (checkNotifyConfig) { if (checkNotifyConfig) {
coreNotifyConfigBuilder.initCacheAndLock(newDynamicThreadPoolNotifyMap); coreNotifyConfigBuilder.initCacheAndLock(newDynamicThreadPoolNotifyMap);
hippoBaseSendMessageService.putPlatform(newDynamicThreadPoolNotifyMap); hippo4jBaseSendMessageService.putPlatform(newDynamicThreadPoolNotifyMap);
} }
ThreadPoolNotifyAlarm threadPoolNotifyAlarm = GlobalNotifyAlarmManage.get(properties.getThreadPoolId()); ThreadPoolNotifyAlarm threadPoolNotifyAlarm = GlobalNotifyAlarmManage.get(properties.getThreadPoolId());
if (threadPoolNotifyAlarm != null && properties.getNotify() != null) { if (threadPoolNotifyAlarm != null && properties.getNotify() != null) {

@ -24,7 +24,7 @@ import cn.hippo4j.core.springboot.starter.config.BootstrapCoreProperties;
import cn.hippo4j.core.springboot.starter.config.ExecutorProperties; import cn.hippo4j.core.springboot.starter.config.ExecutorProperties;
import cn.hippo4j.core.springboot.starter.notify.CoreNotifyConfigBuilder; import cn.hippo4j.core.springboot.starter.notify.CoreNotifyConfigBuilder;
import cn.hippo4j.message.dto.NotifyConfigDTO; import cn.hippo4j.message.dto.NotifyConfigDTO;
import cn.hippo4j.message.service.HippoBaseSendMessageService; import cn.hippo4j.message.service.Hippo4jBaseSendMessageService;
import org.springframework.context.ApplicationListener; import org.springframework.context.ApplicationListener;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
@ -47,7 +47,7 @@ public class PlatformsListener implements ApplicationListener<Hippo4jCoreDynamic
String threadPoolId = executor.getThreadPoolId(); String threadPoolId = executor.getThreadPoolId();
DynamicThreadPoolWrapper wrapper = GlobalThreadPoolManage.getExecutorService(threadPoolId); DynamicThreadPoolWrapper wrapper = GlobalThreadPoolManage.getExecutorService(threadPoolId);
if (wrapper != null && !wrapper.isInitFlag()) { if (wrapper != null && !wrapper.isInitFlag()) {
HippoBaseSendMessageService sendMessageService = ApplicationContextHolder.getBean(HippoBaseSendMessageService.class); Hippo4jBaseSendMessageService sendMessageService = ApplicationContextHolder.getBean(Hippo4jBaseSendMessageService.class);
CoreNotifyConfigBuilder configBuilder = ApplicationContextHolder.getBean(CoreNotifyConfigBuilder.class); CoreNotifyConfigBuilder configBuilder = ApplicationContextHolder.getBean(CoreNotifyConfigBuilder.class);
Map<String, List<NotifyConfigDTO>> notifyConfig = configBuilder.buildSingleNotifyConfig(executor); Map<String, List<NotifyConfigDTO>> notifyConfig = configBuilder.buildSingleNotifyConfig(executor);
sendMessageService.putPlatform(notifyConfig); sendMessageService.putPlatform(notifyConfig);

@ -31,7 +31,7 @@ import cn.hippo4j.core.toolkit.inet.InetUtils;
import cn.hippo4j.message.api.NotifyConfigBuilder; import cn.hippo4j.message.api.NotifyConfigBuilder;
import cn.hippo4j.message.config.MessageConfiguration; import cn.hippo4j.message.config.MessageConfiguration;
import cn.hippo4j.message.service.AlarmControlHandler; import cn.hippo4j.message.service.AlarmControlHandler;
import cn.hippo4j.message.service.HippoSendMessageService; import cn.hippo4j.message.service.Hippo4jSendMessageService;
import cn.hippo4j.springboot.starter.controller.ThreadPoolAdapterController; import cn.hippo4j.springboot.starter.controller.ThreadPoolAdapterController;
import cn.hippo4j.springboot.starter.controller.WebThreadPoolController; import cn.hippo4j.springboot.starter.controller.WebThreadPoolController;
import cn.hippo4j.springboot.starter.controller.WebThreadPoolRunStateController; import cn.hippo4j.springboot.starter.controller.WebThreadPoolRunStateController;
@ -187,7 +187,7 @@ public class DynamicThreadPoolAutoConfiguration {
} }
@Bean @Bean
public ThreadPoolNotifyAlarmHandler threadPoolNotifyAlarmHandler(HippoSendMessageService hippoSendMessageService) { public ThreadPoolNotifyAlarmHandler threadPoolNotifyAlarmHandler(Hippo4jSendMessageService hippoSendMessageService) {
return new ThreadPoolNotifyAlarmHandler(hippoSendMessageService); return new ThreadPoolNotifyAlarmHandler(hippoSendMessageService);
} }
} }

Loading…
Cancel
Save