Review代码修改
parent
0c1f5c9582
commit
7fdd36d979
@ -0,0 +1,29 @@
|
||||
package cn.iocoder.yudao.module.promotion.mq.message.coupon;
|
||||
|
||||
import cn.iocoder.yudao.framework.mq.core.stream.AbstractStreamMessage;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 会员用户创建消息
|
||||
*
|
||||
* @author owen
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class UserCreateMessage extends AbstractStreamMessage {
|
||||
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
@NotNull(message = "用户编号不能为空")
|
||||
private Long userId;
|
||||
|
||||
@Override
|
||||
public String getStreamKey() {
|
||||
return "member.create.send";
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package cn.iocoder.yudao.module.member.mq.producer.user;
|
||||
|
||||
import cn.iocoder.yudao.framework.mq.core.RedisMQTemplate;
|
||||
import cn.iocoder.yudao.module.member.mq.message.user.UserCreateMessage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 会员用户创建 Producer
|
||||
*
|
||||
* @author owen
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class UserCreateProducer {
|
||||
|
||||
@Resource
|
||||
private RedisMQTemplate redisMQTemplate;
|
||||
|
||||
/**
|
||||
* 发送 {@link UserCreateMessage} 消息
|
||||
*
|
||||
* @param userId 用户编号
|
||||
*/
|
||||
public void sendUserCreateMessage(Long userId) {
|
||||
redisMQTemplate.send(new UserCreateMessage().setUserId(userId));
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue