package com.ruoyi.app.utils.event;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

@Component
public class PushEventService {
    @Autowired
    private ApplicationEventPublisher eventPublisher;
    /**
     * 发送事件
     * @param userId
     * @param title
     * @param content
     * @param body
     */
    @Async(value = "threadPoolTaskExecutor")
    public void PublisherEvent(
            Long userId,
            String title,
            String content,
            String body) {
        PushEvent event = new PushEvent(userId, title, content, body);
        eventPublisher.publishEvent(event);
    }
}
