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

import cn.ey.biz.framework.mq.core.pubsub.AbstractChannelMessageListener;
import cn.ey.biz.module.system.mq.message.auth.OAuth2ClientRefreshMessage;
import cn.ey.biz.module.system.service.oauth2.OAuth2ClientService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

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

    @Resource
    private OAuth2ClientService oauth2ClientService;

    @Override
    public void onMessage(OAuth2ClientRefreshMessage oAuth2ClientRefreshMessage) {
        log.info("[execute][收到 OAuth2Client 刷新消息]");
        oauth2ClientService.initLocalCache();
    }
}
