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

import cn.ey.biz.framework.mq.core.pubsub.AbstractChannelMessageListener;
import cn.ey.biz.module.system.mq.message.i8n.I18nRefreshMessage;
import cn.ey.biz.module.system.service.i18n.I18nService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

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

    @Resource
    private I18nService i18nService;

    @Override
    public void onMessage(I18nRefreshMessage i18nRefreshMessage) {
        log.info("[execute][收到 I18n 刷新消息]");
        i18nService.initLocalCache();
    }
}
