mirror of https://github.com/longtai-cn/hippo4j
Configuration change notification & alarm notification reconfiguration (#360)
parent
06cf9b2cb1
commit
b79ea62a6a
@ -0,0 +1,82 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>cn.hippo4j</groupId>
|
||||
<artifactId>hippo4j-all</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<artifactId>hippo4j-message</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cn.hippo4j</groupId>
|
||||
<artifactId>hippo4j-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>alibaba-dingtalk-service-sdk</artifactId>
|
||||
<optional>true</optional>
|
||||
<!-- User feedback that javax.jms cannot be downloaded, log4j is not found useful, so it is excluded for the time being. -->
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifestEntries>
|
||||
<Implementation-Title>${project.artifactId}</Implementation-Title>
|
||||
<Implementation-Version>${project.version}</Implementation-Version>
|
||||
<Build-Time>${maven.build.timestamp}</Build-Time>
|
||||
<Built-By>chen.ma</Built-By>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.10.3</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -0,0 +1,43 @@
|
||||
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();
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue