AprilWind
2024-07-25 e74f0ca6f8af892b707f1504cfd1913461191885
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package org.dromara.monitor.admin.notifier;
 
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.monitor.admin.event.NotifierEvent;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
 
/**
 * 信息通知
 *
 * @author AprilWind
 */
@RequiredArgsConstructor
@Slf4j
@Service
public class InfoNotifier {
 
    /**
     * 异步处理通知事件的方法
     * <p>
     * 该方法会处理 `NotifierEvent` 事件,执行通知相关的操作,如发送邮件或短信
     *
     * @param notifier 事件对象,包含了需要通知的详细信息,包括注册名称、状态名称、实例 ID、状态和服务 URL
     */
    @Async
    @EventListener
    public void infoNotification(NotifierEvent notifier) {
        // 在这里添加处理通知事件的逻辑
        // 例如,依据 notifier 对象的信息发送邮件或短信通知
    }
 
}