/* * Copyright (c) 2018-2028, DreamLu All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: DreamLu 卢春梦 (596392912@qq.com) */ package com.vci.ubcs.admin.dingtalk; import de.codecentric.boot.admin.server.domain.entities.Instance; import de.codecentric.boot.admin.server.domain.entities.InstanceRepository; import de.codecentric.boot.admin.server.domain.events.InstanceEvent; import de.codecentric.boot.admin.server.domain.events.InstanceStatusChangedEvent; import de.codecentric.boot.admin.server.domain.values.Registration; import de.codecentric.boot.admin.server.domain.values.StatusInfo; import de.codecentric.boot.admin.server.notify.AbstractEventNotifier; import lombok.extern.slf4j.Slf4j; import org.springframework.core.env.Environment; import org.springframework.lang.NonNull; import reactor.core.publisher.Mono; import java.time.LocalDateTime; import java.time.ZoneId; import java.time.format.DateTimeFormatter; /** * 服务上下线告警 * *
* 注意:AbstractStatusChangeNotifier 这个事件有毛病 *
* * @author L.cm */ @Slf4j public class DingTalkNotifier extends AbstractEventNotifier { private final DingTalkService dingTalkService; private final MonitorProperties properties; private final Environment environment; public static final DateTimeFormatter DATETIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); public DingTalkNotifier(DingTalkService dingTalkService, MonitorProperties properties, Environment environment, InstanceRepository repository) { super(repository); this.dingTalkService = dingTalkService; this.properties = properties; this.environment = environment; } @NonNull @Override protected Mono