package com.jeequan.jeepay.pay.mq;

import com.jeequan.jeepay.components.mq.model.CleanTnDayCacheMQ;
import com.jeequan.jeepay.core.cache.RedisUtil;
import com.jeequan.jeepay.core.constants.CS;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * 接收MQ消息
 * 业务： 清空所有T+N日期缓存
 * @author zx
 * @date 2023/9/22 9:23
 */
@Slf4j
@Component
public class CleanTnDayCacheMQReceiver implements CleanTnDayCacheMQ.IMQReceiver {

    @Override
    public void receive(CleanTnDayCacheMQ.MsgPayload payload) {

        log.info("成功接收【清空所有T+N日期缓存】的订阅通知, msg={}", payload);
        RedisUtil.delByPrefix(CS.CACHE_KEY_DATE_TN_PREFIX);
        log.info("系统已清空所有T+N日期缓存");
    }
}
