记得上下班打卡 | git大法好,push需谨慎

Commit ca43dfd3 authored by jiangxiulong's avatar jiangxiulong

mongo换成队列 订单和藏品

parent 965d2f68
......@@ -2,9 +2,7 @@ package com.liquidnet.service.consumer.kylin.config;
import com.liquidnet.common.cache.redis.config.RedisStreamConfig;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.kylin.receiver.ConsumerGoblinBizArtworkClqRdsReceiver;
import com.liquidnet.service.consumer.kylin.receiver.ConsumerGoblinBizArtworkUplRdsReceiver;
import com.liquidnet.service.consumer.kylin.receiver.ConsumerGoblinBizIntegralReceiver;
import com.liquidnet.service.consumer.kylin.receiver.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
......@@ -32,6 +30,10 @@ public class ConsumerCommonBizRedisStreamConfig extends RedisStreamConfig {
// ConsumerGoblinBizArtworkGenRdsReceiver consumerGoblinBizArtworkGenRdsReceiver;
@Autowired
ConsumerGoblinBizIntegralReceiver consumerGoblinBizIntegralReceiver;
@Autowired
ConsumerGoblinMdbNftOrderReceiver consumerGoblinMdbNftOrderReceiver;
@Autowired
ConsumerGoblinMdbNftArtworkReceiver consumerGoblinMdbNftArtworkReceiver;
@Bean// 藏品上传声明
public List<Subscription> subscriptionBizArtworkUpl(RedisConnectionFactory factory) {
......@@ -96,4 +98,36 @@ public class ConsumerCommonBizRedisStreamConfig extends RedisStreamConfig {
}
return subscriptionList;
}
@Bean// NFT订单 mongo操作
public List<Subscription> subscriptionBizNftOrder(RedisConnectionFactory factory) {
List<Subscription> subscriptionList = new ArrayList<>();
MQConst.GoblinQueue stream = MQConst.GoblinQueue.BIZ_NFT_MONGO;
this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup());
for (int i = 0; i < 20; i++) {
StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory);
subscriptionList.add(listenerContainer.receiveAutoAck(
Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)),
StreamOffset.create(stream.getKey(), ReadOffset.lastConsumed()), consumerGoblinMdbNftOrderReceiver
));
listenerContainer.start();
}
return subscriptionList;
}
@Bean// NFT数字藏品 mongo操作
public List<Subscription> subscriptionBizNftArtwork(RedisConnectionFactory factory) {
List<Subscription> subscriptionList = new ArrayList<>();
MQConst.GoblinQueue stream = MQConst.GoblinQueue.BIZ_ARTWORK_GEN;
this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup());
for (int i = 0; i < 5; i++) {
StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory);
subscriptionList.add(listenerContainer.receiveAutoAck(
Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)),
StreamOffset.create(stream.getKey(), ReadOffset.lastConsumed()), consumerGoblinMdbNftArtworkReceiver
));
listenerContainer.start();
}
return subscriptionList;
}
}
package com.liquidnet.service.consumer.kylin.receiver;
import com.liquidnet.service.base.constant.MQConst;
import org.springframework.stereotype.Component;
@Component
public class ConsumerGoblinMdbNftArtworkReceiver extends AbstractMdbRedisReceiver {
@Override
protected String getRedisStreamKey() {
return MQConst.GoblinQueue.BIZ_ARTWORK_GEN.getKey();
}
@Override
protected String getRedisStreamGroup() {
return MQConst.GoblinQueue.BIZ_ARTWORK_GEN.getGroup();
}
}
package com.liquidnet.service.consumer.kylin.receiver;
import com.liquidnet.service.base.constant.MQConst;
import org.springframework.stereotype.Component;
@Component
public class ConsumerGoblinMdbNftOrderReceiver extends AbstractMdbRedisReceiver {
@Override
protected String getRedisStreamKey() {
return MQConst.GoblinQueue.BIZ_NFT_MONGO.getKey();
}
@Override
protected String getRedisStreamGroup() {
return MQConst.GoblinQueue.BIZ_NFT_MONGO.getGroup();
}
}
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