diff --git a/hippo4j-common/pom.xml b/hippo4j-common/pom.xml
index 16e75d6f..db080cb4 100644
--- a/hippo4j-common/pom.xml
+++ b/hippo4j-common/pom.xml
@@ -34,24 +34,6 @@
cn.hutool
hutool-all
-
-
- com.aliyun
- alibaba-dingtalk-service-sdk
- true
-
-
-
- log4j
- log4j
-
-
-
-
-
- commons-codec
- commons-codec
-
diff --git a/hippo4j-core/pom.xml b/hippo4j-core/pom.xml
index 474664b8..dd98b20a 100644
--- a/hippo4j-core/pom.xml
+++ b/hippo4j-core/pom.xml
@@ -20,6 +20,11 @@
hippo4j-common
+
+ cn.hippo4j
+ hippo4j-message
+
+
com.aliyun
alibaba-dingtalk-service-sdk
diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/ThreadPoolNotifyAlarmHandler.java b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/ThreadPoolNotifyAlarmHandler.java
index f8841169..9bd9c2f5 100644
--- a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/ThreadPoolNotifyAlarmHandler.java
+++ b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/ThreadPoolNotifyAlarmHandler.java
@@ -17,18 +17,18 @@
package cn.hippo4j.core.executor;
-import cn.hippo4j.common.notify.HippoSendMessageService;
-import cn.hippo4j.common.notify.NotifyTypeEnum;
-import cn.hippo4j.common.notify.ThreadPoolNotifyAlarm;
-import cn.hippo4j.common.notify.request.AlarmNotifyRequest;
-import cn.hippo4j.common.notify.request.ChangeParameterNotifyRequest;
-import cn.hippo4j.core.toolkit.TraceContextUtil;
+import cn.hippo4j.common.toolkit.CalculateUtil;
import cn.hippo4j.common.toolkit.StringUtil;
import cn.hippo4j.core.executor.manage.GlobalNotifyAlarmManage;
import cn.hippo4j.core.executor.manage.GlobalThreadPoolManage;
import cn.hippo4j.core.executor.support.ThreadPoolBuilder;
-import cn.hippo4j.common.toolkit.CalculateUtil;
import cn.hippo4j.core.toolkit.IdentifyUtil;
+import cn.hippo4j.core.toolkit.TraceContextUtil;
+import cn.hippo4j.message.service.HippoSendMessageService;
+import cn.hippo4j.message.enums.NotifyTypeEnum;
+import cn.hippo4j.message.service.ThreadPoolNotifyAlarm;
+import cn.hippo4j.message.request.AlarmNotifyRequest;
+import cn.hippo4j.message.request.ChangeParameterNotifyRequest;
import cn.hutool.core.util.StrUtil;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/manage/GlobalNotifyAlarmManage.java b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/manage/GlobalNotifyAlarmManage.java
index c41fa814..9ca8c33f 100644
--- a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/manage/GlobalNotifyAlarmManage.java
+++ b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/manage/GlobalNotifyAlarmManage.java
@@ -17,7 +17,7 @@
package cn.hippo4j.core.executor.manage;
-import cn.hippo4j.common.notify.ThreadPoolNotifyAlarm;
+import cn.hippo4j.message.service.ThreadPoolNotifyAlarm;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
diff --git a/hippo4j-discovery/pom.xml b/hippo4j-discovery/pom.xml
index b523d475..ca2b97a7 100644
--- a/hippo4j-discovery/pom.xml
+++ b/hippo4j-discovery/pom.xml
@@ -10,7 +10,6 @@
hippo4j-discovery
-
true
diff --git a/hippo4j-message/pom.xml b/hippo4j-message/pom.xml
new file mode 100644
index 00000000..7d88e834
--- /dev/null
+++ b/hippo4j-message/pom.xml
@@ -0,0 +1,82 @@
+
+
+ 4.0.0
+
+ cn.hippo4j
+ hippo4j-all
+ ${revision}
+
+ hippo4j-message
+
+
+
+ cn.hippo4j
+ hippo4j-common
+
+
+
+ org.projectlombok
+ lombok
+
+
+
+ com.aliyun
+ alibaba-dingtalk-service-sdk
+ true
+
+
+
+ log4j
+ log4j
+
+
+
+
+
+ commons-codec
+ commons-codec
+
+
+
+ com.google.guava
+ guava
+
+
+
+ cn.hutool
+ hutool-all
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+
+ ${project.artifactId}
+ ${project.version}
+ ${maven.build.timestamp}
+ chen.ma
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 2.10.3
+
+
+
+ jar
+
+
+
+
+
+
+
diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/api/NotifyConfigBuilder.java b/hippo4j-message/src/main/java/cn/hippo4j/message/api/NotifyConfigBuilder.java
similarity index 92%
rename from hippo4j-common/src/main/java/cn/hippo4j/common/api/NotifyConfigBuilder.java
rename to hippo4j-message/src/main/java/cn/hippo4j/message/api/NotifyConfigBuilder.java
index 2099a875..74dc94c5 100644
--- a/hippo4j-common/src/main/java/cn/hippo4j/common/api/NotifyConfigBuilder.java
+++ b/hippo4j-message/src/main/java/cn/hippo4j/message/api/NotifyConfigBuilder.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package cn.hippo4j.common.api;
+package cn.hippo4j.message.api;
-import cn.hippo4j.common.notify.NotifyConfigDTO;
+import cn.hippo4j.message.dto.NotifyConfigDTO;
import java.util.List;
import java.util.Map;
diff --git a/hippo4j-message/src/main/java/cn/hippo4j/message/config/MessageConfiguration.java b/hippo4j-message/src/main/java/cn/hippo4j/message/config/MessageConfiguration.java
new file mode 100644
index 00000000..8ae5a1bd
--- /dev/null
+++ b/hippo4j-message/src/main/java/cn/hippo4j/message/config/MessageConfiguration.java
@@ -0,0 +1,60 @@
+/*
+ * 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 cn.hippo4j.message.config;
+
+import cn.hippo4j.message.api.NotifyConfigBuilder;
+import cn.hippo4j.message.platform.DingSendMessageHandler;
+import cn.hippo4j.message.platform.LarkSendMessageHandler;
+import cn.hippo4j.message.platform.WeChatSendMessageHandler;
+import cn.hippo4j.message.service.AlarmControlHandler;
+import cn.hippo4j.message.service.HippoBaseSendMessageService;
+import cn.hippo4j.message.service.HippoSendMessageService;
+import cn.hippo4j.message.service.SendMessageHandler;
+import org.springframework.context.annotation.Bean;
+
+/**
+ * Message configuration.
+ */
+public class MessageConfiguration {
+
+ @Bean
+ public HippoSendMessageService hippoSendMessageService(NotifyConfigBuilder serverNotifyConfigBuilder,
+ AlarmControlHandler alarmControlHandler) {
+ return new HippoBaseSendMessageService(serverNotifyConfigBuilder, alarmControlHandler);
+ }
+
+ @Bean
+ public AlarmControlHandler alarmControlHandler() {
+ return new AlarmControlHandler();
+ }
+
+ @Bean
+ public SendMessageHandler dingSendMessageHandler() {
+ return new DingSendMessageHandler();
+ }
+
+ @Bean
+ public SendMessageHandler larkSendMessageHandler() {
+ return new LarkSendMessageHandler();
+ }
+
+ @Bean
+ public SendMessageHandler weChatSendMessageHandler() {
+ return new WeChatSendMessageHandler();
+ }
+}
diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/AlarmControlDTO.java b/hippo4j-message/src/main/java/cn/hippo4j/message/dto/AlarmControlDTO.java
similarity index 89%
rename from hippo4j-common/src/main/java/cn/hippo4j/common/notify/AlarmControlDTO.java
rename to hippo4j-message/src/main/java/cn/hippo4j/message/dto/AlarmControlDTO.java
index 31cc68f0..51ade83a 100644
--- a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/AlarmControlDTO.java
+++ b/hippo4j-message/src/main/java/cn/hippo4j/message/dto/AlarmControlDTO.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package cn.hippo4j.common.notify;
+package cn.hippo4j.message.dto;
-import cn.hutool.core.util.StrUtil;
+import cn.hippo4j.message.enums.NotifyTypeEnum;
import lombok.Builder;
import lombok.Data;
@@ -49,6 +49,6 @@ public class AlarmControlDTO {
* @return
*/
public String buildPk() {
- return StrUtil.builder(threadPool, "+", platform).toString();
+ return threadPool + "+" + platform;
}
}
diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/NotifyConfigDTO.java b/hippo4j-message/src/main/java/cn/hippo4j/message/dto/NotifyConfigDTO.java
similarity index 95%
rename from hippo4j-common/src/main/java/cn/hippo4j/common/notify/NotifyConfigDTO.java
rename to hippo4j-message/src/main/java/cn/hippo4j/message/dto/NotifyConfigDTO.java
index b9298ea2..f3b1e13e 100644
--- a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/NotifyConfigDTO.java
+++ b/hippo4j-message/src/main/java/cn/hippo4j/message/dto/NotifyConfigDTO.java
@@ -15,8 +15,9 @@
* limitations under the License.
*/
-package cn.hippo4j.common.notify;
+package cn.hippo4j.message.dto;
+import cn.hippo4j.message.enums.NotifyTypeEnum;
import lombok.Data;
import lombok.experimental.Accessors;
diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/ThreadPoolNotifyDTO.java b/hippo4j-message/src/main/java/cn/hippo4j/message/dto/ThreadPoolNotifyDTO.java
similarity index 96%
rename from hippo4j-common/src/main/java/cn/hippo4j/common/notify/ThreadPoolNotifyDTO.java
rename to hippo4j-message/src/main/java/cn/hippo4j/message/dto/ThreadPoolNotifyDTO.java
index 7a935bb4..dc25f57f 100644
--- a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/ThreadPoolNotifyDTO.java
+++ b/hippo4j-message/src/main/java/cn/hippo4j/message/dto/ThreadPoolNotifyDTO.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package cn.hippo4j.common.notify;
+package cn.hippo4j.message.dto;
import lombok.Data;
diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/NotifyPlatformEnum.java b/hippo4j-message/src/main/java/cn/hippo4j/message/enums/NotifyPlatformEnum.java
similarity index 96%
rename from hippo4j-common/src/main/java/cn/hippo4j/common/notify/NotifyPlatformEnum.java
rename to hippo4j-message/src/main/java/cn/hippo4j/message/enums/NotifyPlatformEnum.java
index 6d197e65..5ffbad3b 100644
--- a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/NotifyPlatformEnum.java
+++ b/hippo4j-message/src/main/java/cn/hippo4j/message/enums/NotifyPlatformEnum.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package cn.hippo4j.common.notify;
+package cn.hippo4j.message.enums;
/**
* Notify platform enum.
diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/NotifyTypeEnum.java b/hippo4j-message/src/main/java/cn/hippo4j/message/enums/NotifyTypeEnum.java
similarity index 96%
rename from hippo4j-common/src/main/java/cn/hippo4j/common/notify/NotifyTypeEnum.java
rename to hippo4j-message/src/main/java/cn/hippo4j/message/enums/NotifyTypeEnum.java
index f2fc59d9..cc9bc102 100644
--- a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/NotifyTypeEnum.java
+++ b/hippo4j-message/src/main/java/cn/hippo4j/message/enums/NotifyTypeEnum.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package cn.hippo4j.common.notify;
+package cn.hippo4j.message.enums;
/**
* Notify type enum.
diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/platform/DingAlarmConstants.java b/hippo4j-message/src/main/java/cn/hippo4j/message/platform/DingAlarmConstants.java
similarity index 99%
rename from hippo4j-common/src/main/java/cn/hippo4j/common/notify/platform/DingAlarmConstants.java
rename to hippo4j-message/src/main/java/cn/hippo4j/message/platform/DingAlarmConstants.java
index 556832aa..911c6a9a 100644
--- a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/platform/DingAlarmConstants.java
+++ b/hippo4j-message/src/main/java/cn/hippo4j/message/platform/DingAlarmConstants.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package cn.hippo4j.common.notify.platform;
+package cn.hippo4j.message.platform;
/**
* Ding alarm constants.
diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/platform/DingSendMessageHandler.java b/hippo4j-message/src/main/java/cn/hippo4j/message/platform/DingSendMessageHandler.java
similarity index 95%
rename from hippo4j-common/src/main/java/cn/hippo4j/common/notify/platform/DingSendMessageHandler.java
rename to hippo4j-message/src/main/java/cn/hippo4j/message/platform/DingSendMessageHandler.java
index a8a02eeb..d7dd5691 100644
--- a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/platform/DingSendMessageHandler.java
+++ b/hippo4j-message/src/main/java/cn/hippo4j/message/platform/DingSendMessageHandler.java
@@ -15,15 +15,15 @@
* limitations under the License.
*/
-package cn.hippo4j.common.notify.platform;
+package cn.hippo4j.message.platform;
-import cn.hippo4j.common.notify.NotifyConfigDTO;
-import cn.hippo4j.common.notify.NotifyPlatformEnum;
-import cn.hippo4j.common.notify.NotifyTypeEnum;
-import cn.hippo4j.common.notify.SendMessageHandler;
-import cn.hippo4j.common.notify.request.AlarmNotifyRequest;
-import cn.hippo4j.common.notify.request.ChangeParameterNotifyRequest;
import cn.hippo4j.common.toolkit.StringUtil;
+import cn.hippo4j.message.dto.NotifyConfigDTO;
+import cn.hippo4j.message.enums.NotifyPlatformEnum;
+import cn.hippo4j.message.enums.NotifyTypeEnum;
+import cn.hippo4j.message.service.SendMessageHandler;
+import cn.hippo4j.message.request.AlarmNotifyRequest;
+import cn.hippo4j.message.request.ChangeParameterNotifyRequest;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.dingtalk.api.DefaultDingTalkClient;
@@ -42,7 +42,7 @@ import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Objects;
-import static cn.hippo4j.common.notify.platform.DingAlarmConstants.*;
+import static cn.hippo4j.message.platform.DingAlarmConstants.*;
/**
* Send ding notification message.
diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/platform/LarkAlarmConstants.java b/hippo4j-message/src/main/java/cn/hippo4j/message/platform/LarkAlarmConstants.java
similarity index 99%
rename from hippo4j-common/src/main/java/cn/hippo4j/common/notify/platform/LarkAlarmConstants.java
rename to hippo4j-message/src/main/java/cn/hippo4j/message/platform/LarkAlarmConstants.java
index 2f04d6c0..7cec00f6 100644
--- a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/platform/LarkAlarmConstants.java
+++ b/hippo4j-message/src/main/java/cn/hippo4j/message/platform/LarkAlarmConstants.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package cn.hippo4j.common.notify.platform;
+package cn.hippo4j.message.platform;
/**
* Lark alarm constants.
diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/platform/LarkSendMessageHandler.java b/hippo4j-message/src/main/java/cn/hippo4j/message/platform/LarkSendMessageHandler.java
similarity index 94%
rename from hippo4j-common/src/main/java/cn/hippo4j/common/notify/platform/LarkSendMessageHandler.java
rename to hippo4j-message/src/main/java/cn/hippo4j/message/platform/LarkSendMessageHandler.java
index 17c67fa9..933bed5d 100644
--- a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/platform/LarkSendMessageHandler.java
+++ b/hippo4j-message/src/main/java/cn/hippo4j/message/platform/LarkSendMessageHandler.java
@@ -15,14 +15,14 @@
* limitations under the License.
*/
-package cn.hippo4j.common.notify.platform;
+package cn.hippo4j.message.platform;
-import cn.hippo4j.common.notify.NotifyConfigDTO;
-import cn.hippo4j.common.notify.NotifyPlatformEnum;
-import cn.hippo4j.common.notify.NotifyTypeEnum;
-import cn.hippo4j.common.notify.SendMessageHandler;
-import cn.hippo4j.common.notify.request.AlarmNotifyRequest;
-import cn.hippo4j.common.notify.request.ChangeParameterNotifyRequest;
+import cn.hippo4j.message.dto.NotifyConfigDTO;
+import cn.hippo4j.message.enums.NotifyPlatformEnum;
+import cn.hippo4j.message.enums.NotifyTypeEnum;
+import cn.hippo4j.message.service.SendMessageHandler;
+import cn.hippo4j.message.request.AlarmNotifyRequest;
+import cn.hippo4j.message.request.ChangeParameterNotifyRequest;
import cn.hippo4j.common.toolkit.StringUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
@@ -35,7 +35,7 @@ import java.util.Arrays;
import java.util.Objects;
import java.util.stream.Collectors;
-import static cn.hippo4j.common.notify.platform.LarkAlarmConstants.*;
+import static cn.hippo4j.message.platform.LarkAlarmConstants.*;
/**
* Send lark notification message.
diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/platform/WeChatAlarmConstants.java b/hippo4j-message/src/main/java/cn/hippo4j/message/platform/WeChatAlarmConstants.java
similarity index 98%
rename from hippo4j-common/src/main/java/cn/hippo4j/common/notify/platform/WeChatAlarmConstants.java
rename to hippo4j-message/src/main/java/cn/hippo4j/message/platform/WeChatAlarmConstants.java
index f63e1d55..3ab6e146 100644
--- a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/platform/WeChatAlarmConstants.java
+++ b/hippo4j-message/src/main/java/cn/hippo4j/message/platform/WeChatAlarmConstants.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package cn.hippo4j.common.notify.platform;
+package cn.hippo4j.message.platform;
/**
* We chat alarm constants.
diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/platform/WeChatSendMessageHandler.java b/hippo4j-message/src/main/java/cn/hippo4j/message/platform/WeChatSendMessageHandler.java
similarity index 94%
rename from hippo4j-common/src/main/java/cn/hippo4j/common/notify/platform/WeChatSendMessageHandler.java
rename to hippo4j-message/src/main/java/cn/hippo4j/message/platform/WeChatSendMessageHandler.java
index 1d5ddd0b..f3959908 100644
--- a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/platform/WeChatSendMessageHandler.java
+++ b/hippo4j-message/src/main/java/cn/hippo4j/message/platform/WeChatSendMessageHandler.java
@@ -15,13 +15,16 @@
* limitations under the License.
*/
-package cn.hippo4j.common.notify.platform;
+package cn.hippo4j.message.platform;
-import cn.hippo4j.common.notify.*;
-import cn.hippo4j.common.notify.request.AlarmNotifyRequest;
-import cn.hippo4j.common.notify.request.ChangeParameterNotifyRequest;
import cn.hippo4j.common.toolkit.JSONUtil;
import cn.hippo4j.common.toolkit.StringUtil;
+import cn.hippo4j.message.dto.NotifyConfigDTO;
+import cn.hippo4j.message.enums.NotifyPlatformEnum;
+import cn.hippo4j.message.enums.NotifyTypeEnum;
+import cn.hippo4j.message.service.SendMessageHandler;
+import cn.hippo4j.message.request.AlarmNotifyRequest;
+import cn.hippo4j.message.request.ChangeParameterNotifyRequest;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
@@ -32,7 +35,7 @@ import lombok.extern.slf4j.Slf4j;
import java.util.Objects;
-import static cn.hippo4j.common.notify.platform.WeChatAlarmConstants.*;
+import static cn.hippo4j.message.platform.WeChatAlarmConstants.*;
/**
* WeChat send message handler.
diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/request/AlarmNotifyRequest.java b/hippo4j-message/src/main/java/cn/hippo4j/message/request/AlarmNotifyRequest.java
similarity index 94%
rename from hippo4j-common/src/main/java/cn/hippo4j/common/notify/request/AlarmNotifyRequest.java
rename to hippo4j-message/src/main/java/cn/hippo4j/message/request/AlarmNotifyRequest.java
index c95e4353..b57ea82a 100644
--- a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/request/AlarmNotifyRequest.java
+++ b/hippo4j-message/src/main/java/cn/hippo4j/message/request/AlarmNotifyRequest.java
@@ -15,10 +15,10 @@
* limitations under the License.
*/
-package cn.hippo4j.common.notify.request;
+package cn.hippo4j.message.request;
-import cn.hippo4j.common.notify.NotifyTypeEnum;
-import cn.hippo4j.common.notify.request.base.BaseNotifyRequest;
+import cn.hippo4j.message.enums.NotifyTypeEnum;
+import cn.hippo4j.message.request.base.BaseNotifyRequest;
import lombok.Data;
import lombok.experimental.Accessors;
diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/request/ChangeParameterNotifyRequest.java b/hippo4j-message/src/main/java/cn/hippo4j/message/request/ChangeParameterNotifyRequest.java
similarity index 93%
rename from hippo4j-common/src/main/java/cn/hippo4j/common/notify/request/ChangeParameterNotifyRequest.java
rename to hippo4j-message/src/main/java/cn/hippo4j/message/request/ChangeParameterNotifyRequest.java
index ac08f42b..03b7796d 100644
--- a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/request/ChangeParameterNotifyRequest.java
+++ b/hippo4j-message/src/main/java/cn/hippo4j/message/request/ChangeParameterNotifyRequest.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package cn.hippo4j.common.notify.request;
+package cn.hippo4j.message.request;
-import cn.hippo4j.common.notify.request.base.BaseNotifyRequest;
+import cn.hippo4j.message.request.base.BaseNotifyRequest;
import lombok.Data;
/**
diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/request/RobotAlarmNotifyRequest.java b/hippo4j-message/src/main/java/cn/hippo4j/message/request/RobotAlarmNotifyRequest.java
similarity index 95%
rename from hippo4j-common/src/main/java/cn/hippo4j/common/notify/request/RobotAlarmNotifyRequest.java
rename to hippo4j-message/src/main/java/cn/hippo4j/message/request/RobotAlarmNotifyRequest.java
index 26481480..c053b994 100644
--- a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/request/RobotAlarmNotifyRequest.java
+++ b/hippo4j-message/src/main/java/cn/hippo4j/message/request/RobotAlarmNotifyRequest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package cn.hippo4j.common.notify.request;
+package cn.hippo4j.message.request;
import lombok.Data;
diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/request/RobotChangeParameterNotifyRequest.java b/hippo4j-message/src/main/java/cn/hippo4j/message/request/RobotChangeParameterNotifyRequest.java
similarity index 96%
rename from hippo4j-common/src/main/java/cn/hippo4j/common/notify/request/RobotChangeParameterNotifyRequest.java
rename to hippo4j-message/src/main/java/cn/hippo4j/message/request/RobotChangeParameterNotifyRequest.java
index accd9236..64281e45 100644
--- a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/request/RobotChangeParameterNotifyRequest.java
+++ b/hippo4j-message/src/main/java/cn/hippo4j/message/request/RobotChangeParameterNotifyRequest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package cn.hippo4j.common.notify.request;
+package cn.hippo4j.message.request;
import lombok.Data;
diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/request/ThreadPoolNotifyRequest.java b/hippo4j-message/src/main/java/cn/hippo4j/message/request/ThreadPoolNotifyRequest.java
similarity index 96%
rename from hippo4j-common/src/main/java/cn/hippo4j/common/notify/request/ThreadPoolNotifyRequest.java
rename to hippo4j-message/src/main/java/cn/hippo4j/message/request/ThreadPoolNotifyRequest.java
index 49fb5515..34f7c8c8 100644
--- a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/request/ThreadPoolNotifyRequest.java
+++ b/hippo4j-message/src/main/java/cn/hippo4j/message/request/ThreadPoolNotifyRequest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package cn.hippo4j.common.notify.request;
+package cn.hippo4j.message.request;
import lombok.AllArgsConstructor;
import lombok.Data;
diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/request/base/BaseNotifyRequest.java b/hippo4j-message/src/main/java/cn/hippo4j/message/request/base/BaseNotifyRequest.java
similarity index 96%
rename from hippo4j-common/src/main/java/cn/hippo4j/common/notify/request/base/BaseNotifyRequest.java
rename to hippo4j-message/src/main/java/cn/hippo4j/message/request/base/BaseNotifyRequest.java
index 0b8597bd..151bd039 100644
--- a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/request/base/BaseNotifyRequest.java
+++ b/hippo4j-message/src/main/java/cn/hippo4j/message/request/base/BaseNotifyRequest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package cn.hippo4j.common.notify.request.base;
+package cn.hippo4j.message.request.base;
import lombok.Data;
diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/request/base/NotifyRequest.java b/hippo4j-message/src/main/java/cn/hippo4j/message/request/base/NotifyRequest.java
similarity index 94%
rename from hippo4j-common/src/main/java/cn/hippo4j/common/notify/request/base/NotifyRequest.java
rename to hippo4j-message/src/main/java/cn/hippo4j/message/request/base/NotifyRequest.java
index 46b80731..13e0da92 100644
--- a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/request/base/NotifyRequest.java
+++ b/hippo4j-message/src/main/java/cn/hippo4j/message/request/base/NotifyRequest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package cn.hippo4j.common.notify.request.base;
+package cn.hippo4j.message.request.base;
/**
* Notify request.
diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/AlarmControlHandler.java b/hippo4j-message/src/main/java/cn/hippo4j/message/service/AlarmControlHandler.java
similarity index 97%
rename from hippo4j-common/src/main/java/cn/hippo4j/common/notify/AlarmControlHandler.java
rename to hippo4j-message/src/main/java/cn/hippo4j/message/service/AlarmControlHandler.java
index 8d10eeb1..6d33522f 100644
--- a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/AlarmControlHandler.java
+++ b/hippo4j-message/src/main/java/cn/hippo4j/message/service/AlarmControlHandler.java
@@ -15,9 +15,10 @@
* limitations under the License.
*/
-package cn.hippo4j.common.notify;
+package cn.hippo4j.message.service;
import cn.hippo4j.common.constant.Constants;
+import cn.hippo4j.message.dto.AlarmControlDTO;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.google.common.cache.Cache;
diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/HippoBaseSendMessageService.java b/hippo4j-message/src/main/java/cn/hippo4j/message/service/HippoBaseSendMessageService.java
similarity index 93%
rename from hippo4j-common/src/main/java/cn/hippo4j/common/notify/HippoBaseSendMessageService.java
rename to hippo4j-message/src/main/java/cn/hippo4j/message/service/HippoBaseSendMessageService.java
index d2acfd41..1dae394c 100644
--- a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/HippoBaseSendMessageService.java
+++ b/hippo4j-message/src/main/java/cn/hippo4j/message/service/HippoBaseSendMessageService.java
@@ -15,12 +15,15 @@
* limitations under the License.
*/
-package cn.hippo4j.common.notify;
+package cn.hippo4j.message.service;
-import cn.hippo4j.common.api.NotifyConfigBuilder;
+import cn.hippo4j.message.api.NotifyConfigBuilder;
import cn.hippo4j.common.config.ApplicationContextHolder;
-import cn.hippo4j.common.notify.request.AlarmNotifyRequest;
-import cn.hippo4j.common.notify.request.ChangeParameterNotifyRequest;
+import cn.hippo4j.message.dto.AlarmControlDTO;
+import cn.hippo4j.message.dto.NotifyConfigDTO;
+import cn.hippo4j.message.enums.NotifyTypeEnum;
+import cn.hippo4j.message.request.AlarmNotifyRequest;
+import cn.hippo4j.message.request.ChangeParameterNotifyRequest;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.google.common.collect.Maps;
diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/HippoSendMessageService.java b/hippo4j-message/src/main/java/cn/hippo4j/message/service/HippoSendMessageService.java
similarity index 86%
rename from hippo4j-common/src/main/java/cn/hippo4j/common/notify/HippoSendMessageService.java
rename to hippo4j-message/src/main/java/cn/hippo4j/message/service/HippoSendMessageService.java
index a460b95d..0d8c300a 100644
--- a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/HippoSendMessageService.java
+++ b/hippo4j-message/src/main/java/cn/hippo4j/message/service/HippoSendMessageService.java
@@ -15,10 +15,11 @@
* limitations under the License.
*/
-package cn.hippo4j.common.notify;
+package cn.hippo4j.message.service;
-import cn.hippo4j.common.notify.request.AlarmNotifyRequest;
-import cn.hippo4j.common.notify.request.ChangeParameterNotifyRequest;
+import cn.hippo4j.message.enums.NotifyTypeEnum;
+import cn.hippo4j.message.request.AlarmNotifyRequest;
+import cn.hippo4j.message.request.ChangeParameterNotifyRequest;
/**
* Hippo4j send message service.
diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/SendMessageHandler.java b/hippo4j-message/src/main/java/cn/hippo4j/message/service/SendMessageHandler.java
similarity index 91%
rename from hippo4j-common/src/main/java/cn/hippo4j/common/notify/SendMessageHandler.java
rename to hippo4j-message/src/main/java/cn/hippo4j/message/service/SendMessageHandler.java
index 0a9864e5..ecdfa7eb 100644
--- a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/SendMessageHandler.java
+++ b/hippo4j-message/src/main/java/cn/hippo4j/message/service/SendMessageHandler.java
@@ -15,9 +15,10 @@
* limitations under the License.
*/
-package cn.hippo4j.common.notify;
+package cn.hippo4j.message.service;
-import cn.hippo4j.common.notify.request.base.NotifyRequest;
+import cn.hippo4j.message.dto.NotifyConfigDTO;
+import cn.hippo4j.message.request.base.NotifyRequest;
/**
* Send message handler.
diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/ThreadPoolNotifyAlarm.java b/hippo4j-message/src/main/java/cn/hippo4j/message/service/ThreadPoolNotifyAlarm.java
similarity index 97%
rename from hippo4j-common/src/main/java/cn/hippo4j/common/notify/ThreadPoolNotifyAlarm.java
rename to hippo4j-message/src/main/java/cn/hippo4j/message/service/ThreadPoolNotifyAlarm.java
index 68c21051..b2f820c7 100644
--- a/hippo4j-common/src/main/java/cn/hippo4j/common/notify/ThreadPoolNotifyAlarm.java
+++ b/hippo4j-message/src/main/java/cn/hippo4j/message/service/ThreadPoolNotifyAlarm.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package cn.hippo4j.common.notify;
+package cn.hippo4j.message.service;
import lombok.Data;
import lombok.NoArgsConstructor;
diff --git a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/DynamicThreadPoolCoreAutoConfiguration.java b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/DynamicThreadPoolCoreAutoConfiguration.java
index 0ccd107b..6ea62406 100644
--- a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/DynamicThreadPoolCoreAutoConfiguration.java
+++ b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/DynamicThreadPoolCoreAutoConfiguration.java
@@ -17,15 +17,7 @@
package cn.hippo4j.core.springboot.starter.config;
-import cn.hippo4j.common.api.NotifyConfigBuilder;
import cn.hippo4j.common.config.ApplicationContextHolder;
-import cn.hippo4j.common.notify.AlarmControlHandler;
-import cn.hippo4j.common.notify.HippoBaseSendMessageService;
-import cn.hippo4j.common.notify.HippoSendMessageService;
-import cn.hippo4j.common.notify.SendMessageHandler;
-import cn.hippo4j.common.notify.platform.DingSendMessageHandler;
-import cn.hippo4j.common.notify.platform.LarkSendMessageHandler;
-import cn.hippo4j.common.notify.platform.WeChatSendMessageHandler;
import cn.hippo4j.core.config.UtilAutoConfiguration;
import cn.hippo4j.core.config.WebThreadPoolConfiguration;
import cn.hippo4j.core.enable.MarkerConfiguration;
@@ -46,6 +38,10 @@ import cn.hippo4j.core.springboot.starter.refresher.event.PlatformsListener;
import cn.hippo4j.core.springboot.starter.refresher.event.WebExecutorListener;
import cn.hippo4j.core.springboot.starter.support.DynamicThreadPoolPostProcessor;
import cn.hippo4j.core.springboot.starter.support.ThreadPoolAdapterRegister;
+import cn.hippo4j.message.api.NotifyConfigBuilder;
+import cn.hippo4j.message.config.MessageConfiguration;
+import cn.hippo4j.message.service.AlarmControlHandler;
+import cn.hippo4j.message.service.HippoSendMessageService;
import lombok.AllArgsConstructor;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.*;
@@ -65,7 +61,7 @@ import org.springframework.core.annotation.Order;
@AllArgsConstructor
@ConditionalOnBean(MarkerConfiguration.Marker.class)
@EnableConfigurationProperties(BootstrapCoreProperties.class)
-@ImportAutoConfiguration({UtilAutoConfiguration.class, WebThreadPoolConfiguration.class})
+@ImportAutoConfiguration({UtilAutoConfiguration.class, MessageConfiguration.class, WebThreadPoolConfiguration.class})
@ConditionalOnProperty(prefix = BootstrapCoreProperties.PREFIX, value = "enable", matchIfMissing = true, havingValue = "true")
public class DynamicThreadPoolCoreAutoConfiguration {
@@ -86,42 +82,16 @@ public class DynamicThreadPoolCoreAutoConfiguration {
return new ApplicationContextHolder();
}
- @Bean
- public AlarmControlHandler alarmControlHandler() {
- return new AlarmControlHandler();
- }
-
@Bean
public NotifyConfigBuilder notifyConfigBuilder(AlarmControlHandler alarmControlHandler) {
return new CoreNotifyConfigBuilder(alarmControlHandler, bootstrapCoreProperties);
}
- @Bean
- public HippoSendMessageService hippoSendMessageService(NotifyConfigBuilder notifyConfigBuilder,
- AlarmControlHandler alarmControlHandler) {
- return new HippoBaseSendMessageService(notifyConfigBuilder, alarmControlHandler);
- }
-
@Bean
public ThreadPoolNotifyAlarmHandler threadPoolNotifyAlarmHandler(HippoSendMessageService hippoSendMessageService) {
return new ThreadPoolNotifyAlarmHandler(hippoSendMessageService);
}
- @Bean
- public SendMessageHandler dingSendMessageHandler() {
- return new DingSendMessageHandler();
- }
-
- @Bean
- public SendMessageHandler larkSendMessageHandler() {
- return new LarkSendMessageHandler();
- }
-
- @Bean
- public SendMessageHandler weChatSendMessageHandler() {
- return new WeChatSendMessageHandler();
- }
-
@Bean
public DynamicThreadPoolPostProcessor dynamicThreadPoolPostProcessor(ApplicationContextHolder hippo4JApplicationContextHolder) {
return new DynamicThreadPoolPostProcessor(bootstrapCoreProperties);
diff --git a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/ExecutorProperties.java b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/ExecutorProperties.java
index 861213ec..d4c32e42 100644
--- a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/ExecutorProperties.java
+++ b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/ExecutorProperties.java
@@ -17,7 +17,7 @@
package cn.hippo4j.core.springboot.starter.config;
-import cn.hippo4j.common.notify.ThreadPoolNotifyAlarm;
+import cn.hippo4j.message.service.ThreadPoolNotifyAlarm;
import com.google.common.collect.Maps;
import lombok.Data;
import lombok.experimental.Accessors;
diff --git a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/notify/CoreNotifyConfigBuilder.java b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/notify/CoreNotifyConfigBuilder.java
index 34927b9b..7a4d0583 100644
--- a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/notify/CoreNotifyConfigBuilder.java
+++ b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/notify/CoreNotifyConfigBuilder.java
@@ -17,14 +17,14 @@
package cn.hippo4j.core.springboot.starter.notify;
-import cn.hippo4j.common.api.NotifyConfigBuilder;
-import cn.hippo4j.common.notify.AlarmControlHandler;
-import cn.hippo4j.common.notify.NotifyConfigDTO;
import cn.hippo4j.common.toolkit.CollectionUtil;
import cn.hippo4j.common.toolkit.StringUtil;
import cn.hippo4j.core.springboot.starter.config.BootstrapCoreProperties;
import cn.hippo4j.core.springboot.starter.config.ExecutorProperties;
import cn.hippo4j.core.springboot.starter.config.NotifyPlatformProperties;
+import cn.hippo4j.message.service.AlarmControlHandler;
+import cn.hippo4j.message.dto.NotifyConfigDTO;
+import cn.hippo4j.message.api.NotifyConfigBuilder;
import cn.hutool.core.util.StrUtil;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
diff --git a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/BootstrapCorePropertiesBinderAdapt.java b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/BootstrapCorePropertiesBinderAdapt.java
index 155c2c35..7df533e9 100644
--- a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/BootstrapCorePropertiesBinderAdapt.java
+++ b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/BootstrapCorePropertiesBinderAdapt.java
@@ -17,13 +17,13 @@
package cn.hippo4j.core.springboot.starter.refresher;
-import cn.hippo4j.common.notify.NotifyPlatformEnum;
-import cn.hippo4j.common.notify.ThreadPoolNotifyAlarm;
import cn.hippo4j.common.toolkit.CollectionUtil;
import cn.hippo4j.common.toolkit.StringUtil;
import cn.hippo4j.core.springboot.starter.config.BootstrapCoreProperties;
import cn.hippo4j.core.springboot.starter.config.ExecutorProperties;
import cn.hippo4j.core.springboot.starter.config.NotifyPlatformProperties;
+import cn.hippo4j.message.enums.NotifyPlatformEnum;
+import cn.hippo4j.message.service.ThreadPoolNotifyAlarm;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.google.common.collect.Lists;
diff --git a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/ZookeeperRefresherHandler.java b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/ZookeeperRefresherHandler.java
index c9bb82a9..585e16b0 100644
--- a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/ZookeeperRefresherHandler.java
+++ b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/ZookeeperRefresherHandler.java
@@ -17,8 +17,8 @@
package cn.hippo4j.core.springboot.starter.refresher;
-import cn.hippo4j.common.notify.ThreadPoolNotifyAlarm;
import cn.hippo4j.core.executor.manage.GlobalNotifyAlarmManage;
+import cn.hippo4j.message.service.ThreadPoolNotifyAlarm;
import com.google.common.base.Charsets;
import lombok.extern.slf4j.Slf4j;
import org.apache.curator.framework.CuratorFramework;
diff --git a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/event/ExecutorsListener.java b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/event/ExecutorsListener.java
index 04d6c9bf..08fa9cf9 100644
--- a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/event/ExecutorsListener.java
+++ b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/event/ExecutorsListener.java
@@ -17,7 +17,7 @@
package cn.hippo4j.core.springboot.starter.refresher.event;
-import cn.hippo4j.common.notify.request.ChangeParameterNotifyRequest;
+import cn.hippo4j.message.request.ChangeParameterNotifyRequest;
import cn.hippo4j.core.executor.DynamicThreadPoolExecutor;
import cn.hippo4j.core.executor.ThreadPoolNotifyAlarmHandler;
import cn.hippo4j.core.executor.manage.GlobalThreadPoolManage;
diff --git a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/event/PlatformsListener.java b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/event/PlatformsListener.java
index 8eb310f8..f1235434 100644
--- a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/event/PlatformsListener.java
+++ b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/event/PlatformsListener.java
@@ -18,13 +18,13 @@
package cn.hippo4j.core.springboot.starter.refresher.event;
import cn.hippo4j.common.config.ApplicationContextHolder;
-import cn.hippo4j.common.notify.HippoBaseSendMessageService;
-import cn.hippo4j.common.notify.NotifyConfigDTO;
import cn.hippo4j.core.executor.DynamicThreadPoolWrapper;
import cn.hippo4j.core.executor.manage.GlobalThreadPoolManage;
import cn.hippo4j.core.springboot.starter.config.BootstrapCoreProperties;
import cn.hippo4j.core.springboot.starter.config.ExecutorProperties;
import cn.hippo4j.core.springboot.starter.notify.CoreNotifyConfigBuilder;
+import cn.hippo4j.message.dto.NotifyConfigDTO;
+import cn.hippo4j.message.service.HippoBaseSendMessageService;
import org.springframework.context.ApplicationListener;
import org.springframework.core.annotation.Order;
diff --git a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/support/DynamicThreadPoolPostProcessor.java b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/support/DynamicThreadPoolPostProcessor.java
index e0df1042..bff37040 100644
--- a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/support/DynamicThreadPoolPostProcessor.java
+++ b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/support/DynamicThreadPoolPostProcessor.java
@@ -18,7 +18,6 @@
package cn.hippo4j.core.springboot.starter.support;
import cn.hippo4j.common.config.ApplicationContextHolder;
-import cn.hippo4j.common.notify.ThreadPoolNotifyAlarm;
import cn.hippo4j.common.toolkit.StringUtil;
import cn.hippo4j.core.executor.DynamicThreadPool;
import cn.hippo4j.core.executor.DynamicThreadPoolExecutor;
@@ -29,6 +28,7 @@ import cn.hippo4j.core.executor.support.*;
import cn.hippo4j.core.springboot.starter.config.BootstrapCoreProperties;
import cn.hippo4j.core.springboot.starter.config.ExecutorProperties;
import cn.hippo4j.core.toolkit.inet.DynamicThreadPoolAnnotationUtil;
+import cn.hippo4j.message.service.ThreadPoolNotifyAlarm;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeansException;
diff --git a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/config/DynamicThreadPoolAutoConfiguration.java b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/config/DynamicThreadPoolAutoConfiguration.java
index d2cb7669..87c49d25 100644
--- a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/config/DynamicThreadPoolAutoConfiguration.java
+++ b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/config/DynamicThreadPoolAutoConfiguration.java
@@ -24,10 +24,15 @@ import cn.hippo4j.common.config.ApplicationContextHolder;
import cn.hippo4j.core.config.UtilAutoConfiguration;
import cn.hippo4j.core.config.WebThreadPoolConfiguration;
import cn.hippo4j.core.enable.MarkerConfiguration;
+import cn.hippo4j.core.executor.ThreadPoolNotifyAlarmHandler;
import cn.hippo4j.core.executor.state.ThreadPoolRunStateHandler;
import cn.hippo4j.core.handler.DynamicThreadPoolBannerHandler;
import cn.hippo4j.core.toolkit.IdentifyUtil;
import cn.hippo4j.core.toolkit.inet.InetUtils;
+import cn.hippo4j.message.api.NotifyConfigBuilder;
+import cn.hippo4j.message.config.MessageConfiguration;
+import cn.hippo4j.message.service.AlarmControlHandler;
+import cn.hippo4j.message.service.HippoSendMessageService;
import cn.hippo4j.springboot.starter.controller.ThreadPoolAdapterController;
import cn.hippo4j.springboot.starter.controller.WebThreadPoolController;
import cn.hippo4j.springboot.starter.controller.WebThreadPoolRunStateController;
@@ -37,6 +42,7 @@ import cn.hippo4j.springboot.starter.monitor.ReportingEventExecutor;
import cn.hippo4j.springboot.starter.monitor.collect.RunTimeInfoCollector;
import cn.hippo4j.springboot.starter.monitor.send.MessageSender;
import cn.hippo4j.springboot.starter.monitor.send.http.HttpConnectSender;
+import cn.hippo4j.springboot.starter.notify.ServerNotifyConfigBuilder;
import cn.hippo4j.springboot.starter.remote.HttpAgent;
import cn.hippo4j.springboot.starter.remote.HttpScheduledHealthCheck;
import cn.hippo4j.springboot.starter.remote.ServerHealthCheck;
@@ -63,7 +69,7 @@ import org.springframework.core.env.ConfigurableEnvironment;
@ConditionalOnBean(MarkerConfiguration.Marker.class)
@EnableConfigurationProperties(BootstrapProperties.class)
@ConditionalOnProperty(prefix = BootstrapProperties.PREFIX, value = "enable", matchIfMissing = true, havingValue = "true")
-@ImportAutoConfiguration({HttpClientConfiguration.class, NettyClientConfiguration.class, DiscoveryConfiguration.class, MessageNotifyConfiguration.class, UtilAutoConfiguration.class,
+@ImportAutoConfiguration({HttpClientConfiguration.class, NettyClientConfiguration.class, DiscoveryConfiguration.class, MessageConfiguration.class, UtilAutoConfiguration.class,
WebThreadPoolConfiguration.class})
public class DynamicThreadPoolAutoConfiguration {
@@ -167,4 +173,21 @@ public class DynamicThreadPoolAutoConfiguration {
public ThreadPoolAdapterRegister threadPoolAdapterRegister(HttpAgent httpAgent, InetUtils hippo4JInetUtils) {
return new ThreadPoolAdapterRegister(httpAgent, properties, environment, hippo4JInetUtils);
}
+
+ @Bean
+ public NotifyConfigBuilder serverNotifyConfigBuilder(HttpAgent httpAgent,
+ BootstrapProperties properties,
+ AlarmControlHandler alarmControlHandler) {
+ return new ServerNotifyConfigBuilder(httpAgent, properties, alarmControlHandler);
+ }
+
+ @Bean
+ public ServerThreadPoolDynamicRefresh threadPoolDynamicRefresh(ThreadPoolNotifyAlarmHandler threadPoolNotifyAlarmHandler) {
+ return new ServerThreadPoolDynamicRefresh(threadPoolNotifyAlarmHandler);
+ }
+
+ @Bean
+ public ThreadPoolNotifyAlarmHandler threadPoolNotifyAlarmHandler(HippoSendMessageService hippoSendMessageService) {
+ return new ThreadPoolNotifyAlarmHandler(hippoSendMessageService);
+ }
}
diff --git a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/config/MessageNotifyConfiguration.java b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/config/MessageNotifyConfiguration.java
deleted file mode 100644
index 3d30e364..00000000
--- a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/config/MessageNotifyConfiguration.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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 cn.hippo4j.springboot.starter.config;
-
-import cn.hippo4j.common.api.NotifyConfigBuilder;
-import cn.hippo4j.common.notify.*;
-import cn.hippo4j.common.notify.platform.DingSendMessageHandler;
-import cn.hippo4j.common.notify.platform.LarkSendMessageHandler;
-import cn.hippo4j.common.notify.platform.WeChatSendMessageHandler;
-import cn.hippo4j.core.executor.ThreadPoolNotifyAlarmHandler;
-import cn.hippo4j.springboot.starter.core.ServerThreadPoolDynamicRefresh;
-import cn.hippo4j.springboot.starter.notify.ServerNotifyConfigBuilder;
-import cn.hippo4j.springboot.starter.remote.HttpAgent;
-import lombok.AllArgsConstructor;
-import org.springframework.context.annotation.Bean;
-
-/**
- * Message notify config.
- *
- * @author chen.ma
- * @date 2021/8/15 15:39
- */
-@AllArgsConstructor
-public class MessageNotifyConfiguration {
-
- @Bean
- public AlarmControlHandler alarmControlHandler() {
- return new AlarmControlHandler();
- }
-
- @Bean
- public NotifyConfigBuilder notifyConfigBuilder(HttpAgent httpAgent,
- BootstrapProperties properties,
- AlarmControlHandler alarmControlHandler) {
- return new ServerNotifyConfigBuilder(httpAgent, properties, alarmControlHandler);
- }
-
- @Bean
- public HippoSendMessageService hippoSendMessageService(NotifyConfigBuilder notifyConfigBuilder,
- AlarmControlHandler alarmControlHandler) {
- return new HippoBaseSendMessageService(notifyConfigBuilder, alarmControlHandler);
- }
-
- @Bean
- public ThreadPoolNotifyAlarmHandler threadPoolNotifyAlarmHandler(HippoSendMessageService hippoSendMessageService) {
- return new ThreadPoolNotifyAlarmHandler(hippoSendMessageService);
- }
-
- @Bean
- public SendMessageHandler dingSendMessageHandler() {
- return new DingSendMessageHandler();
- }
-
- @Bean
- public SendMessageHandler larkSendMessageHandler() {
- return new LarkSendMessageHandler();
- }
-
- @Bean
- public SendMessageHandler weChatSendMessageHandler() {
- return new WeChatSendMessageHandler();
- }
-
- @Bean
- public ServerThreadPoolDynamicRefresh threadPoolDynamicRefresh(ThreadPoolNotifyAlarmHandler threadPoolNotifyAlarmHandler) {
- return new ServerThreadPoolDynamicRefresh(threadPoolNotifyAlarmHandler);
- }
-}
diff --git a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/core/DynamicThreadPoolPostProcessor.java b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/core/DynamicThreadPoolPostProcessor.java
index effeb8c9..8c81b7a1 100644
--- a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/core/DynamicThreadPoolPostProcessor.java
+++ b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/core/DynamicThreadPoolPostProcessor.java
@@ -21,7 +21,6 @@ import cn.hippo4j.common.config.ApplicationContextHolder;
import cn.hippo4j.common.constant.Constants;
import cn.hippo4j.common.enums.EnableEnum;
import cn.hippo4j.common.model.ThreadPoolParameterInfo;
-import cn.hippo4j.common.notify.ThreadPoolNotifyAlarm;
import cn.hippo4j.common.toolkit.JSONUtil;
import cn.hippo4j.common.web.base.Result;
import cn.hippo4j.core.executor.DynamicThreadPool;
@@ -31,6 +30,7 @@ import cn.hippo4j.core.executor.manage.GlobalNotifyAlarmManage;
import cn.hippo4j.core.executor.manage.GlobalThreadPoolManage;
import cn.hippo4j.core.executor.support.*;
import cn.hippo4j.core.toolkit.inet.DynamicThreadPoolAnnotationUtil;
+import cn.hippo4j.message.service.ThreadPoolNotifyAlarm;
import cn.hippo4j.springboot.starter.config.BootstrapProperties;
import cn.hippo4j.springboot.starter.remote.HttpAgent;
import cn.hutool.core.util.BooleanUtil;
diff --git a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/core/ServerThreadPoolDynamicRefresh.java b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/core/ServerThreadPoolDynamicRefresh.java
index ff7a3120..2d73df29 100644
--- a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/core/ServerThreadPoolDynamicRefresh.java
+++ b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/core/ServerThreadPoolDynamicRefresh.java
@@ -20,7 +20,7 @@ package cn.hippo4j.springboot.starter.core;
import cn.hippo4j.common.enums.EnableEnum;
import cn.hippo4j.common.model.ThreadPoolParameter;
import cn.hippo4j.common.model.ThreadPoolParameterInfo;
-import cn.hippo4j.common.notify.request.ChangeParameterNotifyRequest;
+import cn.hippo4j.message.request.ChangeParameterNotifyRequest;
import cn.hippo4j.common.toolkit.JSONUtil;
import cn.hippo4j.core.executor.DynamicThreadPoolExecutor;
import cn.hippo4j.core.executor.ThreadPoolNotifyAlarmHandler;
diff --git a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/notify/ServerNotifyConfigBuilder.java b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/notify/ServerNotifyConfigBuilder.java
index 03101113..7c4f0244 100644
--- a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/notify/ServerNotifyConfigBuilder.java
+++ b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/notify/ServerNotifyConfigBuilder.java
@@ -17,15 +17,15 @@
package cn.hippo4j.springboot.starter.notify;
-import cn.hippo4j.common.notify.AlarmControlHandler;
-import cn.hippo4j.common.api.NotifyConfigBuilder;
-import cn.hippo4j.common.notify.NotifyConfigDTO;
-import cn.hippo4j.common.notify.ThreadPoolNotifyDTO;
-import cn.hippo4j.common.notify.request.ThreadPoolNotifyRequest;
import cn.hippo4j.common.toolkit.GroupKey;
import cn.hippo4j.common.toolkit.JSONUtil;
import cn.hippo4j.common.web.base.Result;
import cn.hippo4j.core.executor.manage.GlobalThreadPoolManage;
+import cn.hippo4j.message.service.AlarmControlHandler;
+import cn.hippo4j.message.dto.NotifyConfigDTO;
+import cn.hippo4j.message.dto.ThreadPoolNotifyDTO;
+import cn.hippo4j.message.api.NotifyConfigBuilder;
+import cn.hippo4j.message.request.ThreadPoolNotifyRequest;
import cn.hippo4j.springboot.starter.config.BootstrapProperties;
import cn.hippo4j.springboot.starter.remote.HttpAgent;
import cn.hutool.core.collection.CollUtil;
diff --git a/pom.xml b/pom.xml
index 3b13eb58..261f7381 100644
--- a/pom.xml
+++ b/pom.xml
@@ -19,6 +19,7 @@
hippo4j-core
hippo4j-discovery
hippo4j-example
+ hippo4j-message
hippo4j-server
hippo4j-spring-boot
hippo4j-tool
@@ -102,6 +103,12 @@
${revision}
+
+ cn.hippo4j
+ hippo4j-message
+ ${revision}
+
+
cn.hippo4j
hippo4j-config