648540858
2024-04-09 bbf19c79091c46ac5465909429caef6e79c02e55
src/main/java/com/genersoft/iot/vmp/media/event/hook/HookSubscribe.java
@@ -4,14 +4,11 @@
import com.genersoft.iot.vmp.media.event.media.MediaDepartureEvent;
import com.genersoft.iot.vmp.media.event.media.MediaEvent;
import com.genersoft.iot.vmp.media.event.media.MediaPublishEvent;
import org.mybatis.logging.Logger;
import org.mybatis.logging.LoggerFactory;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.time.Instant;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -25,7 +22,7 @@
    /**
     * 订阅数据过期时间
     */
    private final long subscribeExpire = 5 * 1000;
    private final long subscribeExpire = 5 * 60 * 1000;
    @FunctionalInterface
    public interface Event{
@@ -38,8 +35,7 @@
    @Async("taskExecutor")
    @EventListener
    public void onApplicationEvent(MediaArrivalEvent event) {
        if ("rtsp".equals(event.getSchema())) {
            System.out.println("流到来的处理: " + allSubscribes.size());
        if (event.getSchema() == null || "rtsp".equals(event.getSchema())) {
            sendNotify(HookType.on_media_arrival, event);
        }
@@ -51,7 +47,7 @@
    @Async("taskExecutor")
    @EventListener
    public void onApplicationEvent(MediaDepartureEvent event) {
        if ("rtsp".equals(event.getSchema())) {
        if (event.getSchema() == null || "rtsp".equals(event.getSchema())) {
            sendNotify(HookType.on_media_departure, event);
        }