送礼记录-雪花主键-合并topic

This commit is contained in:
2025-09-23 21:57:28 +08:00
parent 1ece3f668f
commit 0e989dbb22
5 changed files with 13 additions and 157 deletions

View File

@@ -5,9 +5,6 @@ public interface MqConstant {
String GIFT_TOPIC = "gift_topic";
String GIFT_CONSUME_GROUP = "gift_consume_group";
String GIFT_TOPIC_V2 = "gift_topic_v2";
String GIFT_CONSUME_V2_GROUP = "gift_consume_v2_group";
String OPEN_BOX_TOPIC = "open_box_topic";
String OPEN_BOX_CONSUME_GROUP = "open_box_consume_group";

View File

@@ -1,29 +0,0 @@
package com.accompany.mq.consumer;
import com.accompany.business.message.GiftMessage;
import com.accompany.business.service.gift.GiftMessageService;
import com.accompany.mq.constant.MqConstant;
import com.accompany.mq.listener.AbstractMessageListener;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;
@Slf4j
@Component
@ConditionalOnProperty(name = "spring.application.name", havingValue = "web")
@RocketMQMessageListener(topic = MqConstant.GIFT_TOPIC_V2, consumerGroup = MqConstant.GIFT_CONSUME_V2_GROUP)
//@RocketMQMessageListener(topic = MqConstant.GIFT_TOPIC, consumerGroup = MqConstant.GIFT_CONSUME_GROUP, consumeMode = ConsumeMode.ORDERLY)
public class GiftMessageV2Consumer extends AbstractMessageListener<GiftMessage> {
@Autowired
private GiftMessageService giftMessageService;
@Override
public void onMessage(GiftMessage giftMessage) {
log.info("onMessage giftMessage: {}", giftMessage.toString());
giftMessageService.handleGiftMessageV2(giftMessage);
}
}