package cn.newfeifan.mall.module.member.mq.producer.shareLinkRegister;

import cn.newfeifan.mall.module.member.message.share.ShareLinkRegisterCreateMessage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 创建链接注册用户与平台之间的关系 Producer
 *
 */
@Slf4j
@Component
public class ShareLinkRegisterProducer {
    @Resource
    private ApplicationContext applicationContext;

    /**
     * 发送 {@link ShareLinkRegisterCreateMessage} 消息
     *
     * @param shareLinkId 链接编号
     * @param registerUserId 注册用户的编号
     */
    public void sendShareLinkRegisterMessage(Long shareLinkId,Long registerUserId){
        applicationContext.publishEvent(new ShareLinkRegisterCreateMessage().setShareLinkId(shareLinkId).setRegisterUserId(registerUserId));
    }
}
