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

Commit f343908f authored by zhanggb's avatar zhanggb

~queue:goblin.SQL_STORE、SQL_GOODS、SQL_COUPON、SQL_ARTWORK_GEN;

parent fd709cc4
...@@ -2,8 +2,7 @@ package com.liquidnet.service.consumer.base.config; ...@@ -2,8 +2,7 @@ package com.liquidnet.service.consumer.base.config;
import com.liquidnet.common.cache.redis.config.RedisStreamConfig; import com.liquidnet.common.cache.redis.config.RedisStreamConfig;
import com.liquidnet.service.base.constant.MQConst; import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.base.receiver.ConsumerCommonSQL0Receiver; import com.liquidnet.service.consumer.base.receiver.*;
import com.liquidnet.service.consumer.base.receiver.ConsumerGoblinNftOrderRdsReceiver;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
...@@ -34,6 +33,30 @@ public class ConsumerCommonSqlRedisStreamConfig extends RedisStreamConfig { ...@@ -34,6 +33,30 @@ public class ConsumerCommonSqlRedisStreamConfig extends RedisStreamConfig {
@Autowired @Autowired
ConsumerGoblinNftOrderRdsReceiver consumerGoblinNftOrderRdsReceiver; ConsumerGoblinNftOrderRdsReceiver consumerGoblinNftOrderRdsReceiver;
@Autowired
ConsumerGoblinSqlStoreRdsReceiver consumerGoblinSqlStoreRdsReceiver;
@Autowired
ConsumerGoblinSqlGoodsRdsReceiver consumerGoblinSqlGoodsRdsReceiver;
@Autowired
ConsumerGoblinSqlCouponRdsReceiver consumerGoblinSqlCouponRdsReceiver;
@Autowired
ConsumerGoblinSqlArtworkGenRdsReceiver consumerGoblinSqlArtworkGenRdsReceiver;
// @Bean
// public List<Subscription> subscriptionSQL0(RedisConnectionFactory factory) {
// List<Subscription> subscriptionList = new ArrayList<>();
// MQConst.CommonQueue stream = MQConst.CommonQueue.SQL0;
// 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()), consumerCommonSQL0Receiver
// ));
// listenerContainer.start();
// }
// return subscriptionList;
// }
/** /**
* goblinNFT订单 * goblinNFT订单
...@@ -56,19 +79,67 @@ public class ConsumerCommonSqlRedisStreamConfig extends RedisStreamConfig { ...@@ -56,19 +79,67 @@ public class ConsumerCommonSqlRedisStreamConfig extends RedisStreamConfig {
return subscriptionList; return subscriptionList;
} }
// @Bean @Bean// 店铺相关
// public List<Subscription> subscriptionSQL0(RedisConnectionFactory factory) { public List<Subscription> subscriptionGoblinSqlStore(RedisConnectionFactory factory) {
// List<Subscription> subscriptionList = new ArrayList<>(); List<Subscription> subscriptionList = new ArrayList<>();
// MQConst.CommonQueue stream = MQConst.CommonQueue.SQL0; MQConst.GoblinQueue stream = MQConst.GoblinQueue.SQL_STORE;
// this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup()); this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup());
// for (int i = 0; i < 5; i++) { for (int i = 0; i < 1; i++) {
// StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory); StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory);
// subscriptionList.add(listenerContainer.receiveAutoAck( subscriptionList.add(listenerContainer.receiveAutoAck(
// Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)), Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)),
// StreamOffset.create(stream.getKey(), ReadOffset.lastConsumed()), consumerCommonSQL0Receiver StreamOffset.create(stream.getKey(), ReadOffset.lastConsumed()), consumerGoblinSqlStoreRdsReceiver
// )); ));
// listenerContainer.start(); listenerContainer.start();
// } }
// return subscriptionList; return subscriptionList;
// } }
@Bean// 商品相关
public List<Subscription> subscriptionGoblinSqlGoods(RedisConnectionFactory factory) {
List<Subscription> subscriptionList = new ArrayList<>();
MQConst.GoblinQueue stream = MQConst.GoblinQueue.SQL_GOODS;
this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup());
for (int i = 0; i < 1; 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()), consumerGoblinSqlGoodsRdsReceiver
));
listenerContainer.start();
}
return subscriptionList;
}
@Bean// 店铺优惠券相关
public List<Subscription> subscriptionGoblinSqlStoreCoupon(RedisConnectionFactory factory) {
List<Subscription> subscriptionList = new ArrayList<>();
MQConst.GoblinQueue stream = MQConst.GoblinQueue.SQL_COUPON;
this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup());
for (int i = 0; i < 1; 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()), consumerGoblinSqlCouponRdsReceiver
));
listenerContainer.start();
}
return subscriptionList;
}
@Bean// 藏品生成
public List<Subscription> subscriptionGoblinSqlArtworkGen(RedisConnectionFactory factory) {
List<Subscription> subscriptionList = new ArrayList<>();
MQConst.GoblinQueue stream = MQConst.GoblinQueue.SQL_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()), consumerGoblinSqlArtworkGenRdsReceiver
));
listenerContainer.start();
}
return subscriptionList;
}
} }
package com.liquidnet.service.consumer.base.receiver;
import com.liquidnet.service.base.constant.MQConst;
import org.springframework.stereotype.Component;
@Component
public class ConsumerGoblinSqlArtworkGenRdsReceiver extends AbstractSqlRedisReceiver {
@Override
protected String getRedisStreamKey() {
return MQConst.GoblinQueue.SQL_ARTWORK_GEN.getKey();
}
@Override
protected String getRedisStreamGroup() {
return MQConst.GoblinQueue.SQL_ARTWORK_GEN.getGroup();
}
}
package com.liquidnet.service.consumer.base.receiver;
import com.liquidnet.service.base.constant.MQConst;
import org.springframework.stereotype.Component;
@Component
public class ConsumerGoblinSqlCouponRdsReceiver extends AbstractSqlRedisReceiver {
@Override
protected String getRedisStreamKey() {
return MQConst.GoblinQueue.SQL_COUPON.getKey();
}
@Override
protected String getRedisStreamGroup() {
return MQConst.GoblinQueue.SQL_COUPON.getGroup();
}
}
package com.liquidnet.service.consumer.base.receiver;
import com.liquidnet.service.base.constant.MQConst;
import org.springframework.stereotype.Component;
@Component
public class ConsumerGoblinSqlGoodsRdsReceiver extends AbstractSqlRedisReceiver {
@Override
protected String getRedisStreamKey() {
return MQConst.GoblinQueue.SQL_GOODS.getKey();
}
@Override
protected String getRedisStreamGroup() {
return MQConst.GoblinQueue.SQL_GOODS.getGroup();
}
}
package com.liquidnet.service.consumer.base.receiver;
import com.liquidnet.service.base.constant.MQConst;
import org.springframework.stereotype.Component;
@Component
public class ConsumerGoblinSqlStoreRdsReceiver extends AbstractSqlRedisReceiver {
@Override
protected String getRedisStreamKey() {
return MQConst.GoblinQueue.SQL_STORE.getKey();
}
@Override
protected String getRedisStreamGroup() {
return MQConst.GoblinQueue.SQL_STORE.getGroup();
}
}
...@@ -22,80 +22,80 @@ import java.util.List; ...@@ -22,80 +22,80 @@ import java.util.List;
public class ConsumerCommonSqlRedisStreamConfig extends RedisStreamConfig { public class ConsumerCommonSqlRedisStreamConfig extends RedisStreamConfig {
@Autowired @Autowired
StringRedisTemplate stringRedisTemplate; StringRedisTemplate stringRedisTemplate;
@Autowired // @Autowired
ConsumerGoblinSqlStoreRdsReceiver consumerGoblinSqlStoreRdsReceiver; // ConsumerGoblinSqlStoreRdsReceiver consumerGoblinSqlStoreRdsReceiver;
@Autowired // @Autowired
ConsumerGoblinSqlGoodsRdsReceiver consumerGoblinSqlGoodsRdsReceiver; // ConsumerGoblinSqlGoodsRdsReceiver consumerGoblinSqlGoodsRdsReceiver;
@Autowired // @Autowired
ConsumerGoblinSqlCouponRdsReceiver consumerGoblinSqlCouponRdsReceiver; // ConsumerGoblinSqlCouponRdsReceiver consumerGoblinSqlCouponRdsReceiver;
@Autowired // @Autowired
ConsumerGoblinSqlArtworkGenRdsReceiver consumerGoblinSqlArtworkGenRdsReceiver; // ConsumerGoblinSqlArtworkGenRdsReceiver consumerGoblinSqlArtworkGenRdsReceiver;
// @Autowired // @Autowired
// ConsumerGoblinNftOrderRdsReceiver consumerGoblinNftOrderRdsReceiver; // ConsumerGoblinNftOrderRdsReceiver consumerGoblinNftOrderRdsReceiver;
@Bean// 店铺相关 // @Bean// 店铺相关
public List<Subscription> subscriptionSqlStore(RedisConnectionFactory factory) { // public List<Subscription> subscriptionSqlStore(RedisConnectionFactory factory) {
List<Subscription> subscriptionList = new ArrayList<>(); // List<Subscription> subscriptionList = new ArrayList<>();
MQConst.GoblinQueue stream = MQConst.GoblinQueue.SQL_STORE; // MQConst.GoblinQueue stream = MQConst.GoblinQueue.SQL_STORE;
this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup()); // this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup());
for (int i = 0; i < 1; i++) { // for (int i = 0; i < 1; i++) {
StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory); // StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory);
subscriptionList.add(listenerContainer.receiveAutoAck( // subscriptionList.add(listenerContainer.receiveAutoAck(
Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)), // Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)),
StreamOffset.create(stream.getKey(), ReadOffset.lastConsumed()), consumerGoblinSqlStoreRdsReceiver // StreamOffset.create(stream.getKey(), ReadOffset.lastConsumed()), consumerGoblinSqlStoreRdsReceiver
)); // ));
listenerContainer.start(); // listenerContainer.start();
} // }
return subscriptionList; // return subscriptionList;
} // }
//
@Bean// 商品相关 // @Bean// 商品相关
public List<Subscription> subscriptionSqlGoods(RedisConnectionFactory factory) { // public List<Subscription> subscriptionSqlGoods(RedisConnectionFactory factory) {
List<Subscription> subscriptionList = new ArrayList<>(); // List<Subscription> subscriptionList = new ArrayList<>();
MQConst.GoblinQueue stream = MQConst.GoblinQueue.SQL_GOODS; // MQConst.GoblinQueue stream = MQConst.GoblinQueue.SQL_GOODS;
this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup()); // this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup());
for (int i = 0; i < 1; i++) { // for (int i = 0; i < 1; i++) {
StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory); // StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory);
subscriptionList.add(listenerContainer.receiveAutoAck( // subscriptionList.add(listenerContainer.receiveAutoAck(
Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)), // Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)),
StreamOffset.create(stream.getKey(), ReadOffset.lastConsumed()), consumerGoblinSqlGoodsRdsReceiver // StreamOffset.create(stream.getKey(), ReadOffset.lastConsumed()), consumerGoblinSqlGoodsRdsReceiver
)); // ));
listenerContainer.start(); // listenerContainer.start();
} // }
return subscriptionList; // return subscriptionList;
} // }
//
@Bean// 店铺优惠券相关 // @Bean// 店铺优惠券相关
public List<Subscription> subscriptionSqlStoreCoupon(RedisConnectionFactory factory) { // public List<Subscription> subscriptionSqlStoreCoupon(RedisConnectionFactory factory) {
List<Subscription> subscriptionList = new ArrayList<>(); // List<Subscription> subscriptionList = new ArrayList<>();
MQConst.GoblinQueue stream = MQConst.GoblinQueue.SQL_COUPON; // MQConst.GoblinQueue stream = MQConst.GoblinQueue.SQL_COUPON;
this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup()); // this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup());
for (int i = 0; i < 1; i++) { // for (int i = 0; i < 1; i++) {
StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory); // StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory);
subscriptionList.add(listenerContainer.receiveAutoAck( // subscriptionList.add(listenerContainer.receiveAutoAck(
Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)), // Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)),
StreamOffset.create(stream.getKey(), ReadOffset.lastConsumed()), consumerGoblinSqlCouponRdsReceiver // StreamOffset.create(stream.getKey(), ReadOffset.lastConsumed()), consumerGoblinSqlCouponRdsReceiver
)); // ));
listenerContainer.start(); // listenerContainer.start();
} // }
return subscriptionList; // return subscriptionList;
} // }
//
@Bean// 藏品生成 // @Bean// 藏品生成
public List<Subscription> subscriptionSqlArtworkGen(RedisConnectionFactory factory) { // public List<Subscription> subscriptionSqlArtworkGen(RedisConnectionFactory factory) {
List<Subscription> subscriptionList = new ArrayList<>(); // List<Subscription> subscriptionList = new ArrayList<>();
MQConst.GoblinQueue stream = MQConst.GoblinQueue.SQL_ARTWORK_GEN; // MQConst.GoblinQueue stream = MQConst.GoblinQueue.SQL_ARTWORK_GEN;
this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup()); // this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup());
for (int i = 0; i < 5; i++) { // for (int i = 0; i < 5; i++) {
StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory); // StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory);
subscriptionList.add(listenerContainer.receiveAutoAck( // subscriptionList.add(listenerContainer.receiveAutoAck(
Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)), // Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)),
StreamOffset.create(stream.getKey(), ReadOffset.lastConsumed()), consumerGoblinSqlArtworkGenRdsReceiver // StreamOffset.create(stream.getKey(), ReadOffset.lastConsumed()), consumerGoblinSqlArtworkGenRdsReceiver
)); // ));
listenerContainer.start(); // listenerContainer.start();
} // }
return subscriptionList; // return subscriptionList;
} // }
// @Bean// NFT订单 // @Bean// NFT订单
// public List<Subscription> subscriptionSqlNftOrder(RedisConnectionFactory factory) { // public List<Subscription> subscriptionSqlNftOrder(RedisConnectionFactory factory) {
......
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