Commit ccd51cb9 authored by honghy's avatar honghy

修改发送消息变更为集群消费,增加打印日志

parent 8c92088d
...@@ -111,6 +111,8 @@ public class YudaoMQAutoConfiguration { ...@@ -111,6 +111,8 @@ public class YudaoMQAutoConfiguration {
.autoAcknowledge(false) // 不自动 ack .autoAcknowledge(false) // 不自动 ack
.cancelOnError(throwable -> false); // 默认配置,发生异常就取消消费,显然不符合预期;因此,我们设置为 false .cancelOnError(throwable -> false); // 默认配置,发生异常就取消消费,显然不符合预期;因此,我们设置为 false
container.register(builder.build(), listener); container.register(builder.build(), listener);
log.info("[redisMessageListenerContainer][注册 streamKey({}) 对应的监听器({})]",
listener.getStreamKey(), listener.getClass().getName());
}); });
return container; return container;
} }
......
package cn.iocoder.yudao.module.system.mq.consumer.sms; package cn.iocoder.yudao.module.system.mq.consumer.sms;
import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessageListener; import cn.iocoder.yudao.framework.mq.core.stream.AbstractStreamMessageListener;
import cn.iocoder.yudao.module.system.mq.message.sms.SmsSendMessageV2; import cn.iocoder.yudao.module.system.mq.message.sms.SmsSendMessageV2;
import cn.iocoder.yudao.module.system.service.sms.SmsSendService; import cn.iocoder.yudao.module.system.service.sms.SmsSendService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -15,7 +15,7 @@ import javax.annotation.Resource; ...@@ -15,7 +15,7 @@ import javax.annotation.Resource;
*/ */
@Component @Component
@Slf4j @Slf4j
public class SmsSendConsumerV2 extends AbstractChannelMessageListener<SmsSendMessageV2> { public class SmsSendConsumerV2 extends AbstractStreamMessageListener<SmsSendMessageV2> {
@Resource @Resource
private SmsSendService smsSendService; private SmsSendService smsSendService;
......
package cn.iocoder.yudao.module.system.mq.message.sms; package cn.iocoder.yudao.module.system.mq.message.sms;
import cn.iocoder.yudao.framework.common.util.json.core.KeyValue; import cn.iocoder.yudao.framework.common.util.json.core.KeyValue;
import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessage; import cn.iocoder.yudao.framework.mq.core.stream.AbstractStreamMessage;
import cn.iocoder.yudao.framework.sms.core.client.dto.SmsTemplateDTO; import cn.iocoder.yudao.framework.sms.core.client.dto.SmsTemplateDTO;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
...@@ -16,7 +16,7 @@ import java.util.List; ...@@ -16,7 +16,7 @@ import java.util.List;
*/ */
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class SmsSendMessageV2 extends AbstractChannelMessage { public class SmsSendMessageV2 extends AbstractStreamMessage {
/** /**
* 短信日志编号 * 短信日志编号
...@@ -42,8 +42,8 @@ public class SmsSendMessageV2 extends AbstractChannelMessage { ...@@ -42,8 +42,8 @@ public class SmsSendMessageV2 extends AbstractChannelMessage {
private List<KeyValue<String, Object>> templateParams; private List<KeyValue<String, Object>> templateParams;
@Override @Override
public String getChannel() { public String getStreamKey() {
return "system.sms.send"; return "system.sms.send.v2";
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment