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

import cn.ey.biz.framework.mq.core.pubsub.AbstractChannelMessageListener;
import cn.ey.biz.module.system.mq.message.permission.PermissionUserRoleRefreshMessage;
import cn.ey.biz.module.system.service.permission.PermissionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

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

    @Resource
    private PermissionService permissionService;

    @Override
    public void onMessage(PermissionUserRoleRefreshMessage permissionUserRoleRefreshMessage) {
        log.info("[execute][收到 User 与 Role 的关联刷新消息]");
        permissionService.initLocalCache();
    }
}
