package cn.ey.biz.module.system.mq.consumer.sensitiveword;

import cn.ey.biz.framework.mq.core.pubsub.AbstractChannelMessageListener;
import cn.ey.biz.module.system.mq.message.sensitiveword.SensitiveWordRefreshMessage;
import cn.ey.biz.module.system.service.sensitiveword.SensitiveWordService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 针对 {@link SensitiveWordRefreshMessage} 的消费者
 */
@Component
@Slf4j
public class SensitiveWordRefreshConsumer extends AbstractChannelMessageListener<SensitiveWordRefreshMessage> {

    @Resource
    private SensitiveWordService sensitiveWordService;

    @Override
    public void onMessage(SensitiveWordRefreshMessage sensitiveWordRefreshMessage) {
        log.info("[execute][收到 SensitiveWord 刷新消息]");
        sensitiveWordService.initLocalCache();
    }
}
