cn.hippo4j.springboot.starter.config.MessageNotifyConfiguration Maven / Gradle / Ivy
/*
* 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);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy