package com.jojubanking.boot.module.system.mq.consumer.deptXq;

import com.jojubanking.boot.framework.mq.core.pubsub.AbstractChannelMessageListener;
import com.jojubanking.boot.module.system.mq.message.dept.DeptRefreshMessage;
import com.jojubanking.boot.module.system.service.dept.DeptService;
import com.jojubanking.boot.module.system.service.deptxq.DeptXqService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 针对 {@link DeptRefreshMessage} 的消费者
 *
 * @author TW
 */
@Component
@Slf4j
public class DeptXqRefreshConsumer extends AbstractChannelMessageListener<DeptRefreshMessage> {

    @Resource
    private DeptXqService deptService;

    @Override
    public void onMessage(DeptRefreshMessage message) {
        log.info("[onMessage][收到 DeptXq 刷新消息]");
        deptService.initLocalCache();
    }

}
