package com.webchat.service.queue;

import com.webchat.common.enums.RedisKeyEnum;
import com.webchat.service.queue.dto.ArticleDelayMessageDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * @author 77
 * @date 2024/11/12 23:59
 */
@Component
@Lazy(value = false)
@Slf4j
public class ArticleDelayPublishQueue extends AbstractRedisDelayQueue<ArticleDelayMessageDTO> {

    @Autowired
    private ArticlePublishQueue articlePublishQueue;


    @PostConstruct
    public void initBean() {
        new Thread(new Runnable() {
            @Override
            public void run() {
                ArticleDelayPublishQueue.super.schedule();
            }
        }).start();
    }

    protected AbstractRedisQueue getRedisDelayNormalQueue() {
        return articlePublishQueue;
    }

    @Override
    protected ArticleDelayMessageDTO convert(String s) {
        return null;
    }

    @Override
    protected String getQueueName() {
        return RedisKeyEnum.QUEUE_ARTICLE_DELAY_PUBLISH_MESSAGE.getKey();
    }
}
