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

Commit 2ec0899b authored by 胡佳晨's avatar 胡佳晨

迁移 consumer-slowly 部分

parent be8ffc98
...@@ -32,7 +32,7 @@ public class ConsumerCandyCouponBackRedisStreamConfig extends RedisStreamConfig ...@@ -32,7 +32,7 @@ public class ConsumerCandyCouponBackRedisStreamConfig extends RedisStreamConfig
List<Subscription> subscriptionList = new ArrayList<>(); List<Subscription> subscriptionList = new ArrayList<>();
MQConst.CandyQueue stream = MQConst.CandyQueue.COUPON_BACK; MQConst.CandyQueue stream = MQConst.CandyQueue.COUPON_BACK;
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 < 3; 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)),
......
...@@ -32,7 +32,7 @@ public class ConsumerCandyCouponOrderBackRedisStreamConfig extends RedisStreamCo ...@@ -32,7 +32,7 @@ public class ConsumerCandyCouponOrderBackRedisStreamConfig extends RedisStreamCo
List<Subscription> subscriptionList = new ArrayList<>(); List<Subscription> subscriptionList = new ArrayList<>();
MQConst.CandyQueue stream = MQConst.CandyQueue.COUPON_ORDER_BACK; MQConst.CandyQueue stream = MQConst.CandyQueue.COUPON_ORDER_BACK;
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 < 3; 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)),
......
...@@ -32,7 +32,7 @@ public class ConsumerCandyCouponReceiveRedisStreamConfig extends RedisStreamConf ...@@ -32,7 +32,7 @@ public class ConsumerCandyCouponReceiveRedisStreamConfig extends RedisStreamConf
List<Subscription> subscriptionList = new ArrayList<>(); List<Subscription> subscriptionList = new ArrayList<>();
MQConst.CandyQueue stream = MQConst.CandyQueue.COUPON_RECEIVE; MQConst.CandyQueue stream = MQConst.CandyQueue.COUPON_RECEIVE;
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 < 3; 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)),
......
...@@ -32,7 +32,7 @@ public class ConsumerCandyCouponUseRedisStreamConfig extends RedisStreamConfig { ...@@ -32,7 +32,7 @@ public class ConsumerCandyCouponUseRedisStreamConfig extends RedisStreamConfig {
List<Subscription> subscriptionList = new ArrayList<>(); List<Subscription> subscriptionList = new ArrayList<>();
MQConst.CandyQueue stream = MQConst.CandyQueue.COUPON_USE; MQConst.CandyQueue stream = MQConst.CandyQueue.COUPON_USE;
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 < 3; 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)),
......
...@@ -30,7 +30,7 @@ public class ConsumerGoblinOrderAGRedisStreamConfig extends RedisStreamConfig { ...@@ -30,7 +30,7 @@ public class ConsumerGoblinOrderAGRedisStreamConfig extends RedisStreamConfig {
List<Subscription> subscriptionList = new ArrayList<>(); List<Subscription> subscriptionList = new ArrayList<>();
MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_ORDER_AGAIN; MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_ORDER_AGAIN;
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 < 3; 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)),
......
...@@ -30,7 +30,7 @@ public class ConsumerGoblinOrderCPRedisStreamConfig extends RedisStreamConfig { ...@@ -30,7 +30,7 @@ public class ConsumerGoblinOrderCPRedisStreamConfig extends RedisStreamConfig {
List<Subscription> subscriptionList = new ArrayList<>(); List<Subscription> subscriptionList = new ArrayList<>();
MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_ORDER_CREATE_PAY; MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_ORDER_CREATE_PAY;
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 < 3; 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)),
......
package com.liquidnet.service.consumer.base.config.goblin;
import com.liquidnet.common.cache.redis.config.RedisStreamConfig;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.base.receiver.goblin.ConsumerGoblinOrderCloseRdsReceiver;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.stream.Consumer;
import org.springframework.data.redis.connection.stream.MapRecord;
import org.springframework.data.redis.connection.stream.ReadOffset;
import org.springframework.data.redis.connection.stream.StreamOffset;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.stream.StreamMessageListenerContainer;
import org.springframework.data.redis.stream.Subscription;
import java.util.ArrayList;
import java.util.List;
@Configuration
public class ConsumerGoblinOrderCRedisStreamConfig extends RedisStreamConfig {
@Autowired
StringRedisTemplate stringRedisTemplate;
@Autowired
ConsumerGoblinOrderCloseRdsReceiver consumerGoblinOrderCloseRdsReceiver;
@Bean//
public List<Subscription> subscriptionSqlGoblinOrderClose(RedisConnectionFactory factory) {
List<Subscription> subscriptionList = new ArrayList<>();
MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_ORDER_CLOSE;
this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup());
for (int i = 0; i < 3; 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()), consumerGoblinOrderCloseRdsReceiver
));
listenerContainer.start();
}
return subscriptionList;
}
}
package com.liquidnet.service.consumer.base.config.goblin;
import com.liquidnet.common.cache.redis.config.RedisStreamConfig;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.base.receiver.goblin.ConsumerGoblinSelfMarketRdsReceiver;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.stream.Consumer;
import org.springframework.data.redis.connection.stream.MapRecord;
import org.springframework.data.redis.connection.stream.ReadOffset;
import org.springframework.data.redis.connection.stream.StreamOffset;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.stream.StreamMessageListenerContainer;
import org.springframework.data.redis.stream.Subscription;
import java.util.ArrayList;
import java.util.List;
@Configuration
public class ConsumerGoblinSelfMarketRedisStreamConfig extends RedisStreamConfig {
@Autowired
StringRedisTemplate stringRedisTemplate;
@Autowired
ConsumerGoblinSelfMarketRdsReceiver consumerGoblinSelfMarketRdsReceiver;
@Bean//
public List<Subscription> selfMarket(RedisConnectionFactory factory) {
List<Subscription> subscriptionList = new ArrayList<>();
MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_SELF_MARKET;
this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup());
for (int i = 0; i < 3; 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()), consumerGoblinSelfMarketRdsReceiver
));
listenerContainer.start();
}
return subscriptionList;
}
}
package com.liquidnet.service.consumer.base.config.goblin;
import com.liquidnet.common.cache.redis.config.RedisStreamConfig;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.base.receiver.goblin.ConsumerGoblinShopCartReceiver;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.stream.Consumer;
import org.springframework.data.redis.connection.stream.MapRecord;
import org.springframework.data.redis.connection.stream.ReadOffset;
import org.springframework.data.redis.connection.stream.StreamOffset;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.stream.StreamMessageListenerContainer;
import org.springframework.data.redis.stream.Subscription;
import java.util.ArrayList;
import java.util.List;
@Configuration
public class ConsumerGoblinShopCartStreamConfig extends RedisStreamConfig {
@Autowired
ConsumerGoblinShopCartReceiver consumerGoblinShopCartReceiver;
@Autowired
StringRedisTemplate stringRedisTemplate;
@Bean//
public List<Subscription> shopCart(RedisConnectionFactory factory) {
List<Subscription> subscriptionList = new ArrayList<>();
MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_SHOP_CART;
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()), consumerGoblinShopCartReceiver
));
listenerContainer.start();
}
return subscriptionList;
}
}
package com.liquidnet.service.consumer.base.config.goblin;
import com.liquidnet.common.cache.redis.config.RedisStreamConfig;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.base.receiver.goblin.ConsumerGoblinStoreMarketRdsReceiver;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.stream.Consumer;
import org.springframework.data.redis.connection.stream.MapRecord;
import org.springframework.data.redis.connection.stream.ReadOffset;
import org.springframework.data.redis.connection.stream.StreamOffset;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.stream.StreamMessageListenerContainer;
import org.springframework.data.redis.stream.Subscription;
import java.util.ArrayList;
import java.util.List;
@Configuration
public class ConsumerGoblinStoneMarketRedisStreamConfig extends RedisStreamConfig {
@Autowired
ConsumerGoblinStoreMarketRdsReceiver consumerGoblinStoreMarketRdsReceiver;
@Autowired
StringRedisTemplate stringRedisTemplate;
@Bean//
public List<Subscription> storeMarket(RedisConnectionFactory factory) {
List<Subscription> subscriptionList = new ArrayList<>();
MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_STORE_MARKET;
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()), consumerGoblinStoreMarketRdsReceiver
));
listenerContainer.start();
}
return subscriptionList;
}
}
package com.liquidnet.service.consumer.base.config.goblin;
import com.liquidnet.common.cache.redis.config.RedisStreamConfig;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.base.receiver.goblin.ConsumerGoblinStoreOrderRdsReceiver;
import lombok.var;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.stream.Consumer;
import org.springframework.data.redis.connection.stream.MapRecord;
import org.springframework.data.redis.connection.stream.ReadOffset;
import org.springframework.data.redis.connection.stream.StreamOffset;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.stream.StreamMessageListenerContainer;
import org.springframework.data.redis.stream.Subscription;
import java.util.ArrayList;
import java.util.List;
@Configuration
public class ConsumerGoblinStoreOrderRedisStreamConfig extends RedisStreamConfig {
@Autowired
ConsumerGoblinStoreOrderRdsReceiver consumerGoblinStoreOrderRdsReceiver;
@Autowired
StringRedisTemplate stringRedisTemplate;
@Bean//
public List<Subscription> storeOrder(RedisConnectionFactory factory) {
List<Subscription> subscriptionList = new ArrayList<>();
MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_STORE_ORDER_OPERA;
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()), consumerGoblinStoreOrderRdsReceiver
));
listenerContainer.start();
}
return subscriptionList;
}
}
package com.liquidnet.service.consumer.base.config.goblin;
import com.liquidnet.common.cache.redis.config.RedisStreamConfig;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.base.receiver.goblin.ConsumerGoblinUserOrderRdsReceiver;
import lombok.var;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.stream.Consumer;
import org.springframework.data.redis.connection.stream.MapRecord;
import org.springframework.data.redis.connection.stream.ReadOffset;
import org.springframework.data.redis.connection.stream.StreamOffset;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.stream.StreamMessageListenerContainer;
import org.springframework.data.redis.stream.Subscription;
import java.util.ArrayList;
import java.util.List;
@Configuration
public class ConsumerGoblinUserOrderRedisStreamConfig extends RedisStreamConfig {
@Autowired
ConsumerGoblinUserOrderRdsReceiver consumerGoblinUserOrderRdsReceiver;
@Autowired
StringRedisTemplate stringRedisTemplate;
@Bean//
public List<Subscription> userOrder(RedisConnectionFactory factory) {
List<Subscription> subscriptionList = new ArrayList<>();
MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_USER_ORDER_OPERA;
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()), consumerGoblinUserOrderRdsReceiver
));
listenerContainer.start();
}
return subscriptionList;
}
}
package com.liquidnet.service.consumer.base.config; package com.liquidnet.service.consumer.base.config.goblin;
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.ConsumerGoblinXlsRdsReceiver; import com.liquidnet.service.consumer.base.receiver.goblin.ConsumerGoblinXlsRdsReceiver;
import lombok.var;
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;
...@@ -32,7 +31,7 @@ public class ConsumerGoblinXlsRedisStreamConfig extends RedisStreamConfig { ...@@ -32,7 +31,7 @@ public class ConsumerGoblinXlsRedisStreamConfig extends RedisStreamConfig {
List<Subscription> subscriptionList = new ArrayList<>(); List<Subscription> subscriptionList = new ArrayList<>();
MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_XLS_OPERA; MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_XLS_OPERA;
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 < 2; 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)),
......
...@@ -33,7 +33,7 @@ public class ConsumerKylinSqlOrderPayRedisStreamConfig extends RedisStreamConfig ...@@ -33,7 +33,7 @@ public class ConsumerKylinSqlOrderPayRedisStreamConfig extends RedisStreamConfig
List<Subscription> subscriptionList = new ArrayList<>(); List<Subscription> subscriptionList = new ArrayList<>();
MQConst.KylinQueue stream = MQConst.KylinQueue.SQL_ORDER_PAY; MQConst.KylinQueue stream = MQConst.KylinQueue.SQL_ORDER_PAY;
this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup()); this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup());
for (int i = 0; i < 3; i++) { for (int i = 0; i < 2; 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)),
......
...@@ -32,7 +32,7 @@ public class ConsumerKylinSqlOrderRefundRedisStreamConfig extends RedisStreamCon ...@@ -32,7 +32,7 @@ public class ConsumerKylinSqlOrderRefundRedisStreamConfig extends RedisStreamCon
List<Subscription> subscriptionList = new ArrayList<>(); List<Subscription> subscriptionList = new ArrayList<>();
MQConst.KylinQueue stream = MQConst.KylinQueue.SQL_ORDER_REFUND; MQConst.KylinQueue stream = MQConst.KylinQueue.SQL_ORDER_REFUND;
this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup()); this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup());
for (int i = 0; i < 3; 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)),
......
package com.liquidnet.service.consumer.base.config.kylin;
import com.liquidnet.common.cache.redis.config.RedisStreamConfig;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.base.receiver.kylin.ConsumerKylinSqlOrderWithdrawRdsReceiver;
import lombok.var;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.stream.Consumer;
import org.springframework.data.redis.connection.stream.MapRecord;
import org.springframework.data.redis.connection.stream.ReadOffset;
import org.springframework.data.redis.connection.stream.StreamOffset;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.stream.StreamMessageListenerContainer;
import org.springframework.data.redis.stream.Subscription;
import java.util.ArrayList;
import java.util.List;
@Configuration
public class ConsumerKylinSqlOrderWithdrawRedisStreamConfig extends RedisStreamConfig {
@Autowired
ConsumerKylinSqlOrderWithdrawRdsReceiver consumerKylinSqlOrderWithdrawRdsReceiver;
@Autowired
StringRedisTemplate stringRedisTemplate;
@Bean//
public List<Subscription> orderWithDraw(RedisConnectionFactory factory) {
List<Subscription> subscriptionList = new ArrayList<>();
MQConst.KylinQueue stream = MQConst.KylinQueue.SQL_ORDER_WITHDRAW;
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()), consumerKylinSqlOrderWithdrawRdsReceiver
));
listenerContainer.start();
}
return subscriptionList;
}
}
package com.liquidnet.service.consumer.base.config.kylin;
import com.liquidnet.common.cache.redis.config.RedisStreamConfig;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.base.receiver.kylin.ConsumerKylinSqlPerformanceLackRdsReceiver;
import lombok.var;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.stream.Consumer;
import org.springframework.data.redis.connection.stream.MapRecord;
import org.springframework.data.redis.connection.stream.ReadOffset;
import org.springframework.data.redis.connection.stream.StreamOffset;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.stream.StreamMessageListenerContainer;
import org.springframework.data.redis.stream.Subscription;
import java.util.ArrayList;
import java.util.List;
@Configuration
public class ConsumerKylinSqlPerformanceLackRedisStreamConfig extends RedisStreamConfig {
@Autowired
ConsumerKylinSqlPerformanceLackRdsReceiver consumerKylinSqlPerformanceLackRdsReceiver;
@Autowired
StringRedisTemplate stringRedisTemplate;
@Bean//
public List<Subscription> lack(RedisConnectionFactory factory) {
List<Subscription> subscriptionList = new ArrayList<>();
MQConst.KylinQueue stream = MQConst.KylinQueue.SQL_PERFORMANCE_LACK;
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()), consumerKylinSqlPerformanceLackRdsReceiver
));
listenerContainer.start();
}
return subscriptionList;
}
}
package com.liquidnet.service.consumer.base.config.kylin;
import com.liquidnet.common.cache.redis.config.RedisStreamConfig;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.base.receiver.kylin.ConsumerKylinTransferRdsReceiver;
import lombok.var;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.stream.Consumer;
import org.springframework.data.redis.connection.stream.MapRecord;
import org.springframework.data.redis.connection.stream.ReadOffset;
import org.springframework.data.redis.connection.stream.StreamOffset;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.stream.StreamMessageListenerContainer;
import org.springframework.data.redis.stream.Subscription;
import java.util.ArrayList;
import java.util.List;
@Configuration
public class ConsumerKylinSqlTransferRedisStreamConfig extends RedisStreamConfig {
@Autowired
ConsumerKylinTransferRdsReceiver consumerKylinTransferRdsReceiver;
@Autowired
StringRedisTemplate stringRedisTemplate;
@Bean//
public List<Subscription> transfer(RedisConnectionFactory factory) {
List<Subscription> subscriptionList = new ArrayList<>();
MQConst.KylinQueue stream = MQConst.KylinQueue.SQL_TRANSFER;
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()), consumerKylinTransferRdsReceiver
));
listenerContainer.start();
}
return subscriptionList;
}
}
package com.liquidnet.service.consumer.base.config.kylin;
import com.liquidnet.common.cache.redis.config.RedisStreamConfig;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.base.receiver.kylin.ConsumerKylinTransferResultRdsReceiver;
import lombok.var;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.stream.Consumer;
import org.springframework.data.redis.connection.stream.MapRecord;
import org.springframework.data.redis.connection.stream.ReadOffset;
import org.springframework.data.redis.connection.stream.StreamOffset;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.stream.StreamMessageListenerContainer;
import org.springframework.data.redis.stream.Subscription;
import java.util.ArrayList;
import java.util.List;
@Configuration
public class ConsumerKylinSqlTransferResultRedisStreamConfig extends RedisStreamConfig {
@Autowired
ConsumerKylinTransferResultRdsReceiver consumerKylinTransferResultRdsReceiver;
@Autowired
StringRedisTemplate stringRedisTemplate;
@Bean//
public List<Subscription> transferResult(RedisConnectionFactory factory) {
List<Subscription> subscriptionList = new ArrayList<>();
MQConst.KylinQueue stream = MQConst.KylinQueue.SQL_TRANSFER_RESULT;
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()), consumerKylinTransferResultRdsReceiver
));
listenerContainer.start();
}
return subscriptionList;
}
}
package com.liquidnet.service.consumer.base.config; package com.liquidnet.service.consumer.base.config.kylin;
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.ConsumerKylinTransferOverTimeRdsReceiver; import com.liquidnet.service.consumer.base.receiver.kylin.ConsumerKylinTransferOverTimeRdsReceiver;
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;
...@@ -36,7 +36,7 @@ public class ConsumerTransferRedisStreamConfig extends RedisStreamConfig { ...@@ -36,7 +36,7 @@ public class ConsumerTransferRedisStreamConfig extends RedisStreamConfig {
List<Subscription> subscriptionList = new ArrayList<>(); List<Subscription> subscriptionList = new ArrayList<>();
MQConst.KylinQueue stream = MQConst.KylinQueue.SQL_TRANSFER_OVERTIME; MQConst.KylinQueue stream = MQConst.KylinQueue.SQL_TRANSFER_OVERTIME;
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 < 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)),
......
...@@ -32,7 +32,7 @@ public class ConsumerStoneLogsRedisStreamConfig extends RedisStreamConfig { ...@@ -32,7 +32,7 @@ public class ConsumerStoneLogsRedisStreamConfig extends RedisStreamConfig {
List<Subscription> subscriptionList = new ArrayList<>(); List<Subscription> subscriptionList = new ArrayList<>();
MQConst.StoneQueue stream = MQConst.StoneQueue.STONE_INSERT_LOGS; MQConst.StoneQueue stream = MQConst.StoneQueue.STONE_INSERT_LOGS;
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 < 3; 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)),
......
...@@ -32,7 +32,7 @@ public class ConsumerStoneOrderRedisStreamConfig extends RedisStreamConfig { ...@@ -32,7 +32,7 @@ public class ConsumerStoneOrderRedisStreamConfig extends RedisStreamConfig {
List<Subscription> subscriptionList = new ArrayList<>(); List<Subscription> subscriptionList = new ArrayList<>();
MQConst.StoneQueue stream = MQConst.StoneQueue.STONE_ORDER_COUPON; MQConst.StoneQueue stream = MQConst.StoneQueue.STONE_ORDER_COUPON;
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 < 3; 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)),
......
...@@ -31,7 +31,7 @@ public class ConsumerStoneUserRedisStreamConfig extends RedisStreamConfig { ...@@ -31,7 +31,7 @@ public class ConsumerStoneUserRedisStreamConfig extends RedisStreamConfig {
List<Subscription> subscriptionList = new ArrayList<>(); List<Subscription> subscriptionList = new ArrayList<>();
MQConst.StoneQueue stream = MQConst.StoneQueue.STONE_INSERT_USER; MQConst.StoneQueue stream = MQConst.StoneQueue.STONE_INSERT_USER;
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 < 3; 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)),
......
package com.liquidnet.service.consumer.base.receiver.goblin;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.base.receiver.AbstractSqlRedisReceiver;
import org.springframework.stereotype.Component;
@Component
public class ConsumerGoblinOrderCloseRdsReceiver extends AbstractSqlRedisReceiver {
@Override
protected String getRedisStreamKey() {
return MQConst.GoblinQueue.GOBLIN_ORDER_CLOSE.getKey();
}
@Override
protected String getRedisStreamGroup() {
return MQConst.GoblinQueue.GOBLIN_ORDER_CLOSE.getGroup();
}
}
package com.liquidnet.service.consumer.base.receiver.goblin;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.base.receiver.AbstractSqlRedisReceiver;
import org.springframework.stereotype.Component;
@Component
public class ConsumerGoblinSelfMarketRdsReceiver extends AbstractSqlRedisReceiver {
@Override
protected String getRedisStreamKey() {
return MQConst.GoblinQueue.GOBLIN_SELF_MARKET.getKey();
}
@Override
protected String getRedisStreamGroup() {
return MQConst.GoblinQueue.GOBLIN_SELF_MARKET.getGroup();
}
}
package com.liquidnet.service.consumer.base.receiver.goblin;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.base.receiver.AbstractSqlRedisReceiver;
import org.springframework.stereotype.Component;
@Component
public class ConsumerGoblinShopCartReceiver extends AbstractSqlRedisReceiver {
@Override
protected String getRedisStreamKey() {
return MQConst.GoblinQueue.GOBLIN_SHOP_CART.getKey();
}
@Override
protected String getRedisStreamGroup() {
return MQConst.GoblinQueue.GOBLIN_SHOP_CART.getGroup();
}
}
package com.liquidnet.service.consumer.base.receiver.goblin;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.base.receiver.AbstractSqlRedisReceiver;
import org.springframework.stereotype.Component;
@Component
public class ConsumerGoblinStoreMarketRdsReceiver extends AbstractSqlRedisReceiver {
@Override
protected String getRedisStreamKey() {
return MQConst.GoblinQueue.GOBLIN_STORE_MARKET.getKey();
}
@Override
protected String getRedisStreamGroup() {
return MQConst.GoblinQueue.GOBLIN_STORE_MARKET.getGroup();
}
}
package com.liquidnet.service.consumer.base.receiver.goblin;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.base.receiver.AbstractSqlRedisReceiver;
import org.springframework.stereotype.Component;
@Component
public class ConsumerGoblinStoreOrderRdsReceiver extends AbstractSqlRedisReceiver {
@Override
protected String getRedisStreamKey() {
return MQConst.GoblinQueue.GOBLIN_STORE_ORDER_OPERA.getKey();
}
@Override
protected String getRedisStreamGroup() {
return MQConst.GoblinQueue.GOBLIN_STORE_ORDER_OPERA.getGroup();
}
}
package com.liquidnet.service.consumer.base.receiver.goblin;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.base.receiver.AbstractSqlRedisReceiver;
import org.springframework.stereotype.Component;
@Component
public class ConsumerGoblinUserOrderRdsReceiver extends AbstractSqlRedisReceiver {
@Override
protected String getRedisStreamKey() {
return MQConst.GoblinQueue.GOBLIN_USER_ORDER_OPERA.getKey();
}
@Override
protected String getRedisStreamGroup() {
return MQConst.GoblinQueue.GOBLIN_USER_ORDER_OPERA.getGroup();
}
}
package com.liquidnet.service.consumer.base.receiver; package com.liquidnet.service.consumer.base.receiver.goblin;
import com.liquidnet.service.base.constant.MQConst; import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.base.receiver.AbstractXlsRedisReceiver;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Component @Component
......
package com.liquidnet.service.consumer.base.receiver.kylin;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.base.receiver.AbstractSqlRedisReceiver;
import org.springframework.stereotype.Component;
@Component
public class ConsumerKylinSqlOrderWithdrawRdsReceiver extends AbstractSqlRedisReceiver {
@Override
protected String getRedisStreamKey() {
return MQConst.KylinQueue.SQL_ORDER_WITHDRAW.getKey();
}
@Override
protected String getRedisStreamGroup() {
return MQConst.KylinQueue.SQL_ORDER_WITHDRAW.getGroup();
}
}
package com.liquidnet.service.consumer.base.receiver.kylin;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.base.receiver.AbstractSqlRedisReceiver;
import org.springframework.stereotype.Component;
@Component
public class ConsumerKylinSqlPerformanceLackRdsReceiver extends AbstractSqlRedisReceiver {
@Override
protected String getRedisStreamKey() {
return MQConst.KylinQueue.SQL_PERFORMANCE_LACK.getKey();
}
@Override
protected String getRedisStreamGroup() {
return MQConst.KylinQueue.SQL_PERFORMANCE_LACK.getGroup();
}
}
package com.liquidnet.service.consumer.base.receiver; package com.liquidnet.service.consumer.base.receiver.kylin;
import com.liquidnet.service.base.constant.MQConst; import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.base.receiver.AbstractOptOrderTransferOverTimeRedisReceiver;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Component @Component
......
package com.liquidnet.service.consumer.base.receiver.kylin;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.base.receiver.AbstractSqlRedisReceiver;
import org.springframework.stereotype.Component;
@Component
public class ConsumerKylinTransferRdsReceiver extends AbstractSqlRedisReceiver {
@Override
protected String getRedisStreamKey() {
return MQConst.KylinQueue.SQL_TRANSFER.getKey();
}
@Override
protected String getRedisStreamGroup() {
return MQConst.KylinQueue.SQL_TRANSFER.getGroup();
}
}
package com.liquidnet.service.consumer.base.receiver.kylin;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.base.receiver.AbstractSqlRedisReceiver;
import org.springframework.stereotype.Component;
@Component
public class ConsumerKylinTransferResultRdsReceiver extends AbstractSqlRedisReceiver {
@Override
protected String getRedisStreamKey() {
return MQConst.KylinQueue.SQL_TRANSFER_RESULT.getKey();
}
@Override
protected String getRedisStreamGroup() {
return MQConst.KylinQueue.SQL_TRANSFER_RESULT.getGroup();
}
}
package com.liquidnet.service.consumer.slowly.config; //package com.liquidnet.service.consumer.slowly.config;
import com.liquidnet.common.cache.redis.config.RedisStreamConfig;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.slowly.receiver.ConsumerGoblinOrderCloseRdsReceiver;
import lombok.var;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.stream.Consumer;
import org.springframework.data.redis.connection.stream.MapRecord;
import org.springframework.data.redis.connection.stream.ReadOffset;
import org.springframework.data.redis.connection.stream.StreamOffset;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.stream.StreamMessageListenerContainer;
import org.springframework.data.redis.stream.Subscription;
import java.util.ArrayList;
import java.util.List;
@Configuration
public class ConsumerGoblinOrderCRedisStreamConfig extends RedisStreamConfig {
@Autowired
StringRedisTemplate stringRedisTemplate;
@Autowired
ConsumerGoblinOrderCloseRdsReceiver consumerGoblinOrderCloseRdsReceiver;
// /**
// * 缺票登记
// *
// * @param listenerContainer
// * @param t
// * @return
// */
// private Subscription receiveGoblinOrderCOrder(StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer, int t) {
// return listenerContainer.receiveAutoAck(Consumer.from(MQConst.GoblinQueue.GOBLIN_ORDER_CLOSE.getGroup(), getConsumerName(MQConst.GoblinQueue.GOBLIN_ORDER_CLOSE.name() + t)),
// StreamOffset.create(MQConst.GoblinQueue.GOBLIN_ORDER_CLOSE.getKey(), ReadOffset.lastConsumed()), consumerGoblinOrderCloseRdsReceiver);
// }
// //
// /* —————————————————————————— | —————————————————————————— | —————————————————————————— */ //import com.liquidnet.common.cache.redis.config.RedisStreamConfig;
//import com.liquidnet.service.base.constant.MQConst;
//import com.liquidnet.service.consumer.slowly.receiver.ConsumerGoblinOrderCloseRdsReceiver;
//import lombok.var;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.data.redis.connection.RedisConnectionFactory;
//import org.springframework.data.redis.connection.stream.Consumer;
//import org.springframework.data.redis.connection.stream.MapRecord;
//import org.springframework.data.redis.connection.stream.ReadOffset;
//import org.springframework.data.redis.connection.stream.StreamOffset;
//import org.springframework.data.redis.core.StringRedisTemplate;
//import org.springframework.data.redis.stream.StreamMessageListenerContainer;
//import org.springframework.data.redis.stream.Subscription;
// //
// /* -------------------------------------------------------- | 缺票登记 */ //import java.util.ArrayList;
//import java.util.List;
// //
// @Bean //@Configuration
// public Subscription subscriptionGoblinOrderC0(RedisConnectionFactory factory) { //public class ConsumerGoblinOrderCRedisStreamConfig extends RedisStreamConfig {
// var listenerContainer = this.buildStreamMessageListenerContainer(factory); // @Autowired
// var subscription = receiveGoblinOrderCOrder(listenerContainer, 0); // StringRedisTemplate stringRedisTemplate;
// listenerContainer.start(); // @Autowired
// return subscription; // ConsumerGoblinOrderCloseRdsReceiver consumerGoblinOrderCloseRdsReceiver;
// }
// @Bean
// public Subscription subscriptionGoblinOrderC1(RedisConnectionFactory factory) {
// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
// var subscription = receiveGoblinOrderCOrder(listenerContainer, 1);
// listenerContainer.start();
// return subscription;
// }
// //
// @Bean //// /**
// public Subscription subscriptionGoblinOrderC2(RedisConnectionFactory factory) { //// * 缺票登记
// var listenerContainer = this.buildStreamMessageListenerContainer(factory); //// *
// var subscription = receiveGoblinOrderCOrder(listenerContainer, 2); //// * @param listenerContainer
//// * @param t
//// * @return
//// */
//// private Subscription receiveGoblinOrderCOrder(StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer, int t) {
//// return listenerContainer.receiveAutoAck(Consumer.from(MQConst.GoblinQueue.GOBLIN_ORDER_CLOSE.getGroup(), getConsumerName(MQConst.GoblinQueue.GOBLIN_ORDER_CLOSE.name() + t)),
//// StreamOffset.create(MQConst.GoblinQueue.GOBLIN_ORDER_CLOSE.getKey(), ReadOffset.lastConsumed()), consumerGoblinOrderCloseRdsReceiver);
//// }
////
//// /* —————————————————————————— | —————————————————————————— | —————————————————————————— */
////
//// /* -------------------------------------------------------- | 缺票登记 */
////
//// @Bean
//// public Subscription subscriptionGoblinOrderC0(RedisConnectionFactory factory) {
//// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
//// var subscription = receiveGoblinOrderCOrder(listenerContainer, 0);
//// listenerContainer.start();
//// return subscription;
//// }
//
//// @Bean
//// public Subscription subscriptionGoblinOrderC1(RedisConnectionFactory factory) {
//// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
//// var subscription = receiveGoblinOrderCOrder(listenerContainer, 1);
//// listenerContainer.start();
//// return subscription;
//// }
////
//// @Bean
//// public Subscription subscriptionGoblinOrderC2(RedisConnectionFactory factory) {
//// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
//// var subscription = receiveGoblinOrderCOrder(listenerContainer, 2);
//// listenerContainer.start();
//// return subscription;
//// }
//
// /* -------------------------------------------------------- | */
//
// @Bean//
// public List<Subscription> subscriptionSqlGoblinOrderClose(RedisConnectionFactory factory) {
// List<Subscription> subscriptionList = new ArrayList<>();
// MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_ORDER_CLOSE;
// 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()), consumerGoblinOrderCloseRdsReceiver
// ));
// listenerContainer.start(); // listenerContainer.start();
// return subscription;
// } // }
// return subscriptionList;
/* -------------------------------------------------------- | */ // }
//}
@Bean//
public List<Subscription> subscriptionSqlGoblinOrderClose(RedisConnectionFactory factory) {
List<Subscription> subscriptionList = new ArrayList<>();
MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_ORDER_CLOSE;
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()), consumerGoblinOrderCloseRdsReceiver
));
listenerContainer.start();
}
return subscriptionList;
}
}
package com.liquidnet.service.consumer.slowly.config; //package com.liquidnet.service.consumer.slowly.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.slowly.receiver.ConsumerGoblinSelfMarketRdsReceiver; //import com.liquidnet.service.consumer.slowly.receiver.ConsumerGoblinSelfMarketRdsReceiver;
import lombok.var; //import lombok.var;
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;
import org.springframework.data.redis.connection.RedisConnectionFactory; //import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.stream.Consumer; //import org.springframework.data.redis.connection.stream.Consumer;
import org.springframework.data.redis.connection.stream.MapRecord; //import org.springframework.data.redis.connection.stream.MapRecord;
import org.springframework.data.redis.connection.stream.ReadOffset; //import org.springframework.data.redis.connection.stream.ReadOffset;
import org.springframework.data.redis.connection.stream.StreamOffset; //import org.springframework.data.redis.connection.stream.StreamOffset;
import org.springframework.data.redis.stream.StreamMessageListenerContainer; //import org.springframework.data.redis.stream.StreamMessageListenerContainer;
import org.springframework.data.redis.stream.Subscription; //import org.springframework.data.redis.stream.Subscription;
//
@Configuration //@Configuration
public class ConsumerGoblinSelfMarketRedisStreamConfig extends RedisStreamConfig { //public class ConsumerGoblinSelfMarketRedisStreamConfig extends RedisStreamConfig {
@Autowired // @Autowired
ConsumerGoblinSelfMarketRdsReceiver consumerGoblinSelfMarketRdsReceiver; // ConsumerGoblinSelfMarketRdsReceiver consumerGoblinSelfMarketRdsReceiver;
//
/** // /**
* 缺票登记 // * 缺票登记
* // *
* @param listenerContainer // * @param listenerContainer
* @param t // * @param t
* @return // * @return
*/ // */
private Subscription receiveGoblinSelfMarket(StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer, int t) { // private Subscription receiveGoblinSelfMarket(StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer, int t) {
return listenerContainer.receiveAutoAck(Consumer.from(MQConst.GoblinQueue.GOBLIN_SELF_MARKET.getGroup(), getConsumerName(MQConst.GoblinQueue.GOBLIN_SELF_MARKET.name() + t)), // return listenerContainer.receiveAutoAck(Consumer.from(MQConst.GoblinQueue.GOBLIN_SELF_MARKET.getGroup(), getConsumerName(MQConst.GoblinQueue.GOBLIN_SELF_MARKET.name() + t)),
StreamOffset.create(MQConst.GoblinQueue.GOBLIN_SELF_MARKET.getKey(), ReadOffset.lastConsumed()), consumerGoblinSelfMarketRdsReceiver); // StreamOffset.create(MQConst.GoblinQueue.GOBLIN_SELF_MARKET.getKey(), ReadOffset.lastConsumed()), consumerGoblinSelfMarketRdsReceiver);
}
/* —————————————————————————— | —————————————————————————— | —————————————————————————— */
/* -------------------------------------------------------- | 缺票登记 */
@Bean
public Subscription subscriptionGoblinSelfMarket0(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receiveGoblinSelfMarket(listenerContainer, 0);
listenerContainer.start();
return subscription;
}
// @Bean
// public Subscription subscriptionGoblinSelfMarket1(RedisConnectionFactory factory) {
// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
// var subscription = receiveGoblinSelfMarket(listenerContainer, 1);
// listenerContainer.start();
// return subscription;
// } // }
// //
// /* —————————————————————————— | —————————————————————————— | —————————————————————————— */
//
// /* -------------------------------------------------------- | 缺票登记 */
//
// @Bean // @Bean
// public Subscription subscriptionGoblinSelfMarket2(RedisConnectionFactory factory) { // public Subscription subscriptionGoblinSelfMarket0(RedisConnectionFactory factory) {
// var listenerContainer = this.buildStreamMessageListenerContainer(factory); // var listenerContainer = this.buildStreamMessageListenerContainer(factory);
// var subscription = receiveGoblinSelfMarket(listenerContainer, 2); // var subscription = receiveGoblinSelfMarket(listenerContainer, 0);
// listenerContainer.start(); // listenerContainer.start();
// return subscription; // return subscription;
// } // }
//
/* -------------------------------------------------------- | */ //// @Bean
} //// public Subscription subscriptionGoblinSelfMarket1(RedisConnectionFactory factory) {
//// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
//// var subscription = receiveGoblinSelfMarket(listenerContainer, 1);
//// listenerContainer.start();
//// return subscription;
//// }
////
//// @Bean
//// public Subscription subscriptionGoblinSelfMarket2(RedisConnectionFactory factory) {
//// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
//// var subscription = receiveGoblinSelfMarket(listenerContainer, 2);
//// listenerContainer.start();
//// return subscription;
//// }
//
// /* -------------------------------------------------------- | */
//}
package com.liquidnet.service.consumer.slowly.config; //package com.liquidnet.service.consumer.slowly.config;
import com.liquidnet.common.cache.redis.config.RedisStreamConfig;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.slowly.receiver.ConsumerGoblinShopCartReceiver;
import lombok.var;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.stream.Consumer;
import org.springframework.data.redis.connection.stream.MapRecord;
import org.springframework.data.redis.connection.stream.ReadOffset;
import org.springframework.data.redis.connection.stream.StreamOffset;
import org.springframework.data.redis.stream.StreamMessageListenerContainer;
import org.springframework.data.redis.stream.Subscription;
@Configuration
public class ConsumerGoblinShopCartStreamConfig extends RedisStreamConfig {
@Autowired
ConsumerGoblinShopCartReceiver consumerGoblinShopCartReceiver;
/**
* 购物车
* @return Subscription
*/
private Subscription receiveSqlShopCart(StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer, int t) {
return listenerContainer.receiveAutoAck(Consumer.from(MQConst.GoblinQueue.GOBLIN_SHOP_CART.getGroup(), getConsumerName(MQConst.GoblinQueue.GOBLIN_SHOP_CART.name() + t)),
StreamOffset.create(MQConst.GoblinQueue.GOBLIN_SHOP_CART.getKey(), ReadOffset.lastConsumed()), consumerGoblinShopCartReceiver);
}
/* -------------------------------------------------------- | */
@Bean
public Subscription subscriptionSqlShopCart0(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receiveSqlShopCart(listenerContainer, 0);
listenerContainer.start();
return subscription;
}
// @Bean
// public Subscription subscriptionSqlShopCart1(RedisConnectionFactory factory) {
// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
// var subscription = receiveSqlShopCart(listenerContainer, 1);
// listenerContainer.start();
// return subscription;
// }
// //
// @Bean //import com.liquidnet.common.cache.redis.config.RedisStreamConfig;
// public Subscription subscriptionSqlShopCart2(RedisConnectionFactory factory) { //import com.liquidnet.service.base.constant.MQConst;
// var listenerContainer = this.buildStreamMessageListenerContainer(factory); //import com.liquidnet.service.consumer.slowly.receiver.ConsumerGoblinShopCartReceiver;
// var subscription = receiveSqlShopCart(listenerContainer, 2); //import lombok.var;
// listenerContainer.start(); //import org.springframework.beans.factory.annotation.Autowired;
// return subscription; //import org.springframework.context.annotation.Bean;
// } //import org.springframework.context.annotation.Configuration;
//import org.springframework.data.redis.connection.RedisConnectionFactory;
//import org.springframework.data.redis.connection.stream.Consumer;
//import org.springframework.data.redis.connection.stream.MapRecord;
//import org.springframework.data.redis.connection.stream.ReadOffset;
//import org.springframework.data.redis.connection.stream.StreamOffset;
//import org.springframework.data.redis.stream.StreamMessageListenerContainer;
//import org.springframework.data.redis.stream.Subscription;
// //
// @Bean //@Configuration
// public Subscription subscriptionSqlShopCart3(RedisConnectionFactory factory) { //public class ConsumerGoblinShopCartStreamConfig extends RedisStreamConfig {
// var listenerContainer = this.buildStreamMessageListenerContainer(factory); // @Autowired
// var subscription = receiveSqlShopCart(listenerContainer, 3); // ConsumerGoblinShopCartReceiver consumerGoblinShopCartReceiver;
// listenerContainer.start(); //
// return subscription; // /**
// * 购物车
// * @return Subscription
// */
// private Subscription receiveSqlShopCart(StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer, int t) {
// return listenerContainer.receiveAutoAck(Consumer.from(MQConst.GoblinQueue.GOBLIN_SHOP_CART.getGroup(), getConsumerName(MQConst.GoblinQueue.GOBLIN_SHOP_CART.name() + t)),
// StreamOffset.create(MQConst.GoblinQueue.GOBLIN_SHOP_CART.getKey(), ReadOffset.lastConsumed()), consumerGoblinShopCartReceiver);
// } // }
// //
// /* -------------------------------------------------------- | */
//
// @Bean // @Bean
// public Subscription subscriptionSqlShopCart4(RedisConnectionFactory factory) { // public Subscription subscriptionSqlShopCart0(RedisConnectionFactory factory) {
// var listenerContainer = this.buildStreamMessageListenerContainer(factory); // var listenerContainer = this.buildStreamMessageListenerContainer(factory);
// var subscription = receiveSqlShopCart(listenerContainer, 4); // var subscription = receiveSqlShopCart(listenerContainer, 0);
// listenerContainer.start(); // listenerContainer.start();
// return subscription; // return subscription;
// } // }
//
/* -------------------------------------------------------- | */ //// @Bean
//// public Subscription subscriptionSqlShopCart1(RedisConnectionFactory factory) {
} //// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
//// var subscription = receiveSqlShopCart(listenerContainer, 1);
//// listenerContainer.start();
//// return subscription;
//// }
////
//// @Bean
//// public Subscription subscriptionSqlShopCart2(RedisConnectionFactory factory) {
//// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
//// var subscription = receiveSqlShopCart(listenerContainer, 2);
//// listenerContainer.start();
//// return subscription;
//// }
////
//// @Bean
//// public Subscription subscriptionSqlShopCart3(RedisConnectionFactory factory) {
//// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
//// var subscription = receiveSqlShopCart(listenerContainer, 3);
//// listenerContainer.start();
//// return subscription;
//// }
////
//// @Bean
//// public Subscription subscriptionSqlShopCart4(RedisConnectionFactory factory) {
//// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
//// var subscription = receiveSqlShopCart(listenerContainer, 4);
//// listenerContainer.start();
//// return subscription;
//// }
//
// /* -------------------------------------------------------- | */
//
//}
package com.liquidnet.service.consumer.slowly.config; //package com.liquidnet.service.consumer.slowly.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.slowly.receiver.ConsumerGoblinStoreMarketRdsReceiver; //import com.liquidnet.service.consumer.slowly.receiver.ConsumerGoblinStoreMarketRdsReceiver;
import lombok.var; //import lombok.var;
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;
import org.springframework.data.redis.connection.RedisConnectionFactory; //import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.stream.Consumer; //import org.springframework.data.redis.connection.stream.Consumer;
import org.springframework.data.redis.connection.stream.MapRecord; //import org.springframework.data.redis.connection.stream.MapRecord;
import org.springframework.data.redis.connection.stream.ReadOffset; //import org.springframework.data.redis.connection.stream.ReadOffset;
import org.springframework.data.redis.connection.stream.StreamOffset; //import org.springframework.data.redis.connection.stream.StreamOffset;
import org.springframework.data.redis.stream.StreamMessageListenerContainer; //import org.springframework.data.redis.stream.StreamMessageListenerContainer;
import org.springframework.data.redis.stream.Subscription; //import org.springframework.data.redis.stream.Subscription;
//
@Configuration //@Configuration
public class ConsumerGoblinStoneMarketRedisStreamConfig extends RedisStreamConfig { //public class ConsumerGoblinStoneMarketRedisStreamConfig extends RedisStreamConfig {
@Autowired // @Autowired
ConsumerGoblinStoreMarketRdsReceiver consumerGoblinStoreMarketRdsReceiver; // ConsumerGoblinStoreMarketRdsReceiver consumerGoblinStoreMarketRdsReceiver;
//
/** // /**
* 缺票登记 // * 缺票登记
* // *
* @param listenerContainer // * @param listenerContainer
* @param t // * @param t
* @return // * @return
*/ // */
private Subscription receiveGoblinStoreMarket(StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer, int t) { // private Subscription receiveGoblinStoreMarket(StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer, int t) {
return listenerContainer.receiveAutoAck(Consumer.from(MQConst.GoblinQueue.GOBLIN_STORE_MARKET.getGroup(), getConsumerName(MQConst.GoblinQueue.GOBLIN_STORE_MARKET.name() + t)), // return listenerContainer.receiveAutoAck(Consumer.from(MQConst.GoblinQueue.GOBLIN_STORE_MARKET.getGroup(), getConsumerName(MQConst.GoblinQueue.GOBLIN_STORE_MARKET.name() + t)),
StreamOffset.create(MQConst.GoblinQueue.GOBLIN_STORE_MARKET.getKey(), ReadOffset.lastConsumed()), consumerGoblinStoreMarketRdsReceiver); // StreamOffset.create(MQConst.GoblinQueue.GOBLIN_STORE_MARKET.getKey(), ReadOffset.lastConsumed()), consumerGoblinStoreMarketRdsReceiver);
}
/* —————————————————————————— | —————————————————————————— | —————————————————————————— */
/* -------------------------------------------------------- | 缺票登记 */
@Bean
public Subscription subscriptionGoblinStoreMarket0(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receiveGoblinStoreMarket(listenerContainer, 0);
listenerContainer.start();
return subscription;
}
// @Bean
// public Subscription subscriptionGoblinStoreMarket1(RedisConnectionFactory factory) {
// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
// var subscription = receiveGoblinStoreMarket(listenerContainer, 1);
// listenerContainer.start();
// return subscription;
// } // }
// //
// /* —————————————————————————— | —————————————————————————— | —————————————————————————— */
//
// /* -------------------------------------------------------- | 缺票登记 */
//
// @Bean // @Bean
// public Subscription subscriptionGoblinStoreMarket2(RedisConnectionFactory factory) { // public Subscription subscriptionGoblinStoreMarket0(RedisConnectionFactory factory) {
// var listenerContainer = this.buildStreamMessageListenerContainer(factory); // var listenerContainer = this.buildStreamMessageListenerContainer(factory);
// var subscription = receiveGoblinStoreMarket(listenerContainer, 2); // var subscription = receiveGoblinStoreMarket(listenerContainer, 0);
// listenerContainer.start(); // listenerContainer.start();
// return subscription; // return subscription;
// } // }
//
/* -------------------------------------------------------- | */ //// @Bean
} //// public Subscription subscriptionGoblinStoreMarket1(RedisConnectionFactory factory) {
//// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
//// var subscription = receiveGoblinStoreMarket(listenerContainer, 1);
//// listenerContainer.start();
//// return subscription;
//// }
////
//// @Bean
//// public Subscription subscriptionGoblinStoreMarket2(RedisConnectionFactory factory) {
//// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
//// var subscription = receiveGoblinStoreMarket(listenerContainer, 2);
//// listenerContainer.start();
//// return subscription;
//// }
//
// /* -------------------------------------------------------- | */
//}
package com.liquidnet.service.consumer.slowly.config; //package com.liquidnet.service.consumer.slowly.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.slowly.receiver.ConsumerGoblinStoreOrderRdsReceiver; //import com.liquidnet.service.consumer.slowly.receiver.ConsumerGoblinStoreOrderRdsReceiver;
import lombok.var; //import lombok.var;
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;
import org.springframework.data.redis.connection.RedisConnectionFactory; //import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.stream.Consumer; //import org.springframework.data.redis.connection.stream.Consumer;
import org.springframework.data.redis.connection.stream.MapRecord; //import org.springframework.data.redis.connection.stream.MapRecord;
import org.springframework.data.redis.connection.stream.ReadOffset; //import org.springframework.data.redis.connection.stream.ReadOffset;
import org.springframework.data.redis.connection.stream.StreamOffset; //import org.springframework.data.redis.connection.stream.StreamOffset;
import org.springframework.data.redis.stream.StreamMessageListenerContainer; //import org.springframework.data.redis.stream.StreamMessageListenerContainer;
import org.springframework.data.redis.stream.Subscription; //import org.springframework.data.redis.stream.Subscription;
//
@Configuration //@Configuration
public class ConsumerGoblinStoreOrderRedisStreamConfig extends RedisStreamConfig { //public class ConsumerGoblinStoreOrderRedisStreamConfig extends RedisStreamConfig {
@Autowired // @Autowired
ConsumerGoblinStoreOrderRdsReceiver consumerGoblinStoreOrderRdsReceiver; // ConsumerGoblinStoreOrderRdsReceiver consumerGoblinStoreOrderRdsReceiver;
//
/** // /**
* 缺票登记 // * 缺票登记
* // *
* @param listenerContainer // * @param listenerContainer
* @param t // * @param t
* @return // * @return
*/ // */
private Subscription receiveGoblinStoreOrder(StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer, int t) { // private Subscription receiveGoblinStoreOrder(StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer, int t) {
return listenerContainer.receiveAutoAck(Consumer.from(MQConst.GoblinQueue.GOBLIN_STORE_ORDER_OPERA.getGroup(), getConsumerName(MQConst.GoblinQueue.GOBLIN_STORE_ORDER_OPERA.name() + t)), // return listenerContainer.receiveAutoAck(Consumer.from(MQConst.GoblinQueue.GOBLIN_STORE_ORDER_OPERA.getGroup(), getConsumerName(MQConst.GoblinQueue.GOBLIN_STORE_ORDER_OPERA.name() + t)),
StreamOffset.create(MQConst.GoblinQueue.GOBLIN_STORE_ORDER_OPERA.getKey(), ReadOffset.lastConsumed()), consumerGoblinStoreOrderRdsReceiver); // StreamOffset.create(MQConst.GoblinQueue.GOBLIN_STORE_ORDER_OPERA.getKey(), ReadOffset.lastConsumed()), consumerGoblinStoreOrderRdsReceiver);
}
/* —————————————————————————— | —————————————————————————— | —————————————————————————— */
/* -------------------------------------------------------- | 缺票登记 */
@Bean
public Subscription subscriptionGoblinStoreOrder0(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receiveGoblinStoreOrder(listenerContainer, 0);
listenerContainer.start();
return subscription;
}
// @Bean
// public Subscription subscriptionGoblinStoreOrder1(RedisConnectionFactory factory) {
// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
// var subscription = receiveGoblinStoreOrder(listenerContainer, 1);
// listenerContainer.start();
// return subscription;
// } // }
// //
// /* —————————————————————————— | —————————————————————————— | —————————————————————————— */
//
// /* -------------------------------------------------------- | 缺票登记 */
//
// @Bean // @Bean
// public Subscription subscriptionGoblinStoreOrder2(RedisConnectionFactory factory) { // public Subscription subscriptionGoblinStoreOrder0(RedisConnectionFactory factory) {
// var listenerContainer = this.buildStreamMessageListenerContainer(factory); // var listenerContainer = this.buildStreamMessageListenerContainer(factory);
// var subscription = receiveGoblinStoreOrder(listenerContainer, 2); // var subscription = receiveGoblinStoreOrder(listenerContainer, 0);
// listenerContainer.start(); // listenerContainer.start();
// return subscription; // return subscription;
// } // }
//
/* -------------------------------------------------------- | */ //// @Bean
} //// public Subscription subscriptionGoblinStoreOrder1(RedisConnectionFactory factory) {
//// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
//// var subscription = receiveGoblinStoreOrder(listenerContainer, 1);
//// listenerContainer.start();
//// return subscription;
//// }
////
//// @Bean
//// public Subscription subscriptionGoblinStoreOrder2(RedisConnectionFactory factory) {
//// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
//// var subscription = receiveGoblinStoreOrder(listenerContainer, 2);
//// listenerContainer.start();
//// return subscription;
//// }
//
// /* -------------------------------------------------------- | */
//}
package com.liquidnet.service.consumer.slowly.config; //package com.liquidnet.service.consumer.slowly.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.slowly.receiver.ConsumerGoblinUserOrderRdsReceiver; //import com.liquidnet.service.consumer.slowly.receiver.ConsumerGoblinUserOrderRdsReceiver;
import lombok.var; //import lombok.var;
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;
import org.springframework.data.redis.connection.RedisConnectionFactory; //import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.stream.Consumer; //import org.springframework.data.redis.connection.stream.Consumer;
import org.springframework.data.redis.connection.stream.MapRecord; //import org.springframework.data.redis.connection.stream.MapRecord;
import org.springframework.data.redis.connection.stream.ReadOffset; //import org.springframework.data.redis.connection.stream.ReadOffset;
import org.springframework.data.redis.connection.stream.StreamOffset; //import org.springframework.data.redis.connection.stream.StreamOffset;
import org.springframework.data.redis.stream.StreamMessageListenerContainer; //import org.springframework.data.redis.stream.StreamMessageListenerContainer;
import org.springframework.data.redis.stream.Subscription; //import org.springframework.data.redis.stream.Subscription;
//
@Configuration //@Configuration
public class ConsumerGoblinUserOrderRedisStreamConfig extends RedisStreamConfig { //public class ConsumerGoblinUserOrderRedisStreamConfig extends RedisStreamConfig {
@Autowired // @Autowired
ConsumerGoblinUserOrderRdsReceiver consumerGoblinUserOrderRdsReceiver; // ConsumerGoblinUserOrderRdsReceiver consumerGoblinUserOrderRdsReceiver;
//
/** // /**
* 缺票登记 // * 缺票登记
* // *
* @param listenerContainer // * @param listenerContainer
* @param t // * @param t
* @return // * @return
*/ // */
private Subscription receiveGoblinUserOrder(StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer, int t) { // private Subscription receiveGoblinUserOrder(StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer, int t) {
return listenerContainer.receiveAutoAck(Consumer.from(MQConst.GoblinQueue.GOBLIN_USER_ORDER_OPERA.getGroup(), getConsumerName(MQConst.GoblinQueue.GOBLIN_USER_ORDER_OPERA.name() + t)), // return listenerContainer.receiveAutoAck(Consumer.from(MQConst.GoblinQueue.GOBLIN_USER_ORDER_OPERA.getGroup(), getConsumerName(MQConst.GoblinQueue.GOBLIN_USER_ORDER_OPERA.name() + t)),
StreamOffset.create(MQConst.GoblinQueue.GOBLIN_USER_ORDER_OPERA.getKey(), ReadOffset.lastConsumed()), consumerGoblinUserOrderRdsReceiver); // StreamOffset.create(MQConst.GoblinQueue.GOBLIN_USER_ORDER_OPERA.getKey(), ReadOffset.lastConsumed()), consumerGoblinUserOrderRdsReceiver);
}
/* —————————————————————————— | —————————————————————————— | —————————————————————————— */
/* -------------------------------------------------------- | 缺票登记 */
@Bean
public Subscription subscriptionGoblinUserOrder0(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receiveGoblinUserOrder(listenerContainer, 0);
listenerContainer.start();
return subscription;
}
// @Bean
// public Subscription subscriptionGoblinUserOrder1(RedisConnectionFactory factory) {
// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
// var subscription = receiveGoblinUserOrder(listenerContainer, 1);
// listenerContainer.start();
// return subscription;
// } // }
// //
// /* —————————————————————————— | —————————————————————————— | —————————————————————————— */
//
// /* -------------------------------------------------------- | 缺票登记 */
//
// @Bean // @Bean
// public Subscription subscriptionGoblinUserOrder2(RedisConnectionFactory factory) { // public Subscription subscriptionGoblinUserOrder0(RedisConnectionFactory factory) {
// var listenerContainer = this.buildStreamMessageListenerContainer(factory); // var listenerContainer = this.buildStreamMessageListenerContainer(factory);
// var subscription = receiveGoblinUserOrder(listenerContainer, 2); // var subscription = receiveGoblinUserOrder(listenerContainer, 0);
// listenerContainer.start(); // listenerContainer.start();
// return subscription; // return subscription;
// } // }
//
/* -------------------------------------------------------- | */ //// @Bean
} //// public Subscription subscriptionGoblinUserOrder1(RedisConnectionFactory factory) {
//// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
//// var subscription = receiveGoblinUserOrder(listenerContainer, 1);
//// listenerContainer.start();
//// return subscription;
//// }
////
//// @Bean
//// public Subscription subscriptionGoblinUserOrder2(RedisConnectionFactory factory) {
//// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
//// var subscription = receiveGoblinUserOrder(listenerContainer, 2);
//// listenerContainer.start();
//// return subscription;
//// }
//
// /* -------------------------------------------------------- | */
//}
package com.liquidnet.service.consumer.slowly.config; //package com.liquidnet.service.consumer.slowly.config;
import com.liquidnet.common.cache.redis.config.RedisStreamConfig;
import com.liquidnet.service.consumer.slowly.receiver.ConsumerKylinSqlOrderWithdrawRdsReceiver;
import lombok.var;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.stream.Consumer;
import org.springframework.data.redis.connection.stream.MapRecord;
import org.springframework.data.redis.connection.stream.ReadOffset;
import org.springframework.data.redis.connection.stream.StreamOffset;
import org.springframework.data.redis.stream.StreamMessageListenerContainer;
import org.springframework.data.redis.stream.Subscription;
import static com.liquidnet.service.base.constant.MQConst.KylinQueue.SQL_ORDER_WITHDRAW;
@Configuration
public class ConsumerKylinSqlOrderWithdrawRedisStreamConfig extends RedisStreamConfig {
@Autowired
ConsumerKylinSqlOrderWithdrawRdsReceiver consumerKylinSqlOrderWithdrawRdsReceiver;
/**
* 订单申请撤回
*
* @param listenerContainer
* @param t
* @return
*/
private Subscription receiveSqlOrderWithdraw(StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer, int t) {
return listenerContainer.receiveAutoAck(Consumer.from(SQL_ORDER_WITHDRAW.getGroup(), getConsumerName(SQL_ORDER_WITHDRAW.name() + t)),
StreamOffset.create(SQL_ORDER_WITHDRAW.getKey(), ReadOffset.lastConsumed()), consumerKylinSqlOrderWithdrawRdsReceiver);
}
/* —————————————————————————— | —————————————————————————— | —————————————————————————— */
/* -------------------------------------------------------- | 订单申请撤回 */
@Bean
public Subscription subscriptionSqlOrderWithdraw0(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receiveSqlOrderWithdraw(listenerContainer, 0);
listenerContainer.start();
return subscription;
}
// @Bean
// public Subscription subscriptionSqlOrderWithdraw1(RedisConnectionFactory factory) {
// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
// var subscription = receiveSqlOrderWithdraw(listenerContainer, 1);
// listenerContainer.start();
// return subscription;
// }
// //
// @Bean //import com.liquidnet.common.cache.redis.config.RedisStreamConfig;
// public Subscription subscriptionSqlOrderWithdraw2(RedisConnectionFactory factory) { //import com.liquidnet.service.consumer.slowly.receiver.ConsumerKylinSqlOrderWithdrawRdsReceiver;
// var listenerContainer = this.buildStreamMessageListenerContainer(factory); //import lombok.var;
// var subscription = receiveSqlOrderWithdraw(listenerContainer, 2); //import org.springframework.beans.factory.annotation.Autowired;
// listenerContainer.start(); //import org.springframework.context.annotation.Bean;
// return subscription; //import org.springframework.context.annotation.Configuration;
// } //import org.springframework.data.redis.connection.RedisConnectionFactory;
//import org.springframework.data.redis.connection.stream.Consumer;
// @Bean //import org.springframework.data.redis.connection.stream.MapRecord;
// public Subscription subscriptionSqlOrderWithdraw3(RedisConnectionFactory factory) { //import org.springframework.data.redis.connection.stream.ReadOffset;
// var listenerContainer = this.buildStreamMessageListenerContainer(factory); //import org.springframework.data.redis.connection.stream.StreamOffset;
// var subscription = receiveSqlOrderWithdraw(listenerContainer, 3); //import org.springframework.data.redis.stream.StreamMessageListenerContainer;
// listenerContainer.start(); //import org.springframework.data.redis.stream.Subscription;
// return subscription; //
//import static com.liquidnet.service.base.constant.MQConst.KylinQueue.SQL_ORDER_WITHDRAW;
//
//@Configuration
//public class ConsumerKylinSqlOrderWithdrawRedisStreamConfig extends RedisStreamConfig {
// @Autowired
// ConsumerKylinSqlOrderWithdrawRdsReceiver consumerKylinSqlOrderWithdrawRdsReceiver;
//
// /**
// * 订单申请撤回
// *
// * @param listenerContainer
// * @param t
// * @return
// */
// private Subscription receiveSqlOrderWithdraw(StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer, int t) {
// return listenerContainer.receiveAutoAck(Consumer.from(SQL_ORDER_WITHDRAW.getGroup(), getConsumerName(SQL_ORDER_WITHDRAW.name() + t)),
// StreamOffset.create(SQL_ORDER_WITHDRAW.getKey(), ReadOffset.lastConsumed()), consumerKylinSqlOrderWithdrawRdsReceiver);
// } // }
// //
// /* —————————————————————————— | —————————————————————————— | —————————————————————————— */
//
// /* -------------------------------------------------------- | 订单申请撤回 */
//
// @Bean // @Bean
// public Subscription subscriptionSqlOrderWithdraw4(RedisConnectionFactory factory) { // public Subscription subscriptionSqlOrderWithdraw0(RedisConnectionFactory factory) {
// var listenerContainer = this.buildStreamMessageListenerContainer(factory); // var listenerContainer = this.buildStreamMessageListenerContainer(factory);
// var subscription = receiveSqlOrderWithdraw(listenerContainer, 4); // var subscription = receiveSqlOrderWithdraw(listenerContainer, 0);
// listenerContainer.start(); // listenerContainer.start();
// return subscription; // return subscription;
// } // }
//
/* -------------------------------------------------------- | */ //// @Bean
} //// public Subscription subscriptionSqlOrderWithdraw1(RedisConnectionFactory factory) {
//// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
//// var subscription = receiveSqlOrderWithdraw(listenerContainer, 1);
//// listenerContainer.start();
//// return subscription;
//// }
////
//// @Bean
//// public Subscription subscriptionSqlOrderWithdraw2(RedisConnectionFactory factory) {
//// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
//// var subscription = receiveSqlOrderWithdraw(listenerContainer, 2);
//// listenerContainer.start();
//// return subscription;
//// }
//
//// @Bean
//// public Subscription subscriptionSqlOrderWithdraw3(RedisConnectionFactory factory) {
//// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
//// var subscription = receiveSqlOrderWithdraw(listenerContainer, 3);
//// listenerContainer.start();
//// return subscription;
//// }
////
//// @Bean
//// public Subscription subscriptionSqlOrderWithdraw4(RedisConnectionFactory factory) {
//// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
//// var subscription = receiveSqlOrderWithdraw(listenerContainer, 4);
//// listenerContainer.start();
//// return subscription;
//// }
//
// /* -------------------------------------------------------- | */
//}
package com.liquidnet.service.consumer.slowly.config; //package com.liquidnet.service.consumer.slowly.config;
//
import com.liquidnet.common.cache.redis.config.RedisStreamConfig; //import com.liquidnet.common.cache.redis.config.RedisStreamConfig;
import com.liquidnet.service.consumer.slowly.receiver.ConsumerKylinSqlPerformanceLackRdsReceiver; //import com.liquidnet.service.consumer.slowly.receiver.ConsumerKylinSqlPerformanceLackRdsReceiver;
import lombok.var; //import lombok.var;
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;
import org.springframework.data.redis.connection.RedisConnectionFactory; //import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.stream.Consumer; //import org.springframework.data.redis.connection.stream.Consumer;
import org.springframework.data.redis.connection.stream.MapRecord; //import org.springframework.data.redis.connection.stream.MapRecord;
import org.springframework.data.redis.connection.stream.ReadOffset; //import org.springframework.data.redis.connection.stream.ReadOffset;
import org.springframework.data.redis.connection.stream.StreamOffset; //import org.springframework.data.redis.connection.stream.StreamOffset;
import org.springframework.data.redis.stream.StreamMessageListenerContainer; //import org.springframework.data.redis.stream.StreamMessageListenerContainer;
import org.springframework.data.redis.stream.Subscription; //import org.springframework.data.redis.stream.Subscription;
//
import static com.liquidnet.service.base.constant.MQConst.KylinQueue.SQL_PERFORMANCE_LACK; //import static com.liquidnet.service.base.constant.MQConst.KylinQueue.SQL_PERFORMANCE_LACK;
//
@Configuration //@Configuration
public class ConsumerKylinSqlPerformanceLackRedisStreamConfig extends RedisStreamConfig { //public class ConsumerKylinSqlPerformanceLackRedisStreamConfig extends RedisStreamConfig {
@Autowired // @Autowired
ConsumerKylinSqlPerformanceLackRdsReceiver consumerKylinSqlPerformanceLackRdsReceiver; // ConsumerKylinSqlPerformanceLackRdsReceiver consumerKylinSqlPerformanceLackRdsReceiver;
//
/** // /**
* 缺票登记 // * 缺票登记
* // *
* @param listenerContainer // * @param listenerContainer
* @param t // * @param t
* @return // * @return
*/ // */
private Subscription receiveSqlPerformanceLack(StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer, int t) { // private Subscription receiveSqlPerformanceLack(StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer, int t) {
return listenerContainer.receiveAutoAck(Consumer.from(SQL_PERFORMANCE_LACK.getGroup(), getConsumerName(SQL_PERFORMANCE_LACK.name() + t)), // return listenerContainer.receiveAutoAck(Consumer.from(SQL_PERFORMANCE_LACK.getGroup(), getConsumerName(SQL_PERFORMANCE_LACK.name() + t)),
StreamOffset.create(SQL_PERFORMANCE_LACK.getKey(), ReadOffset.lastConsumed()), consumerKylinSqlPerformanceLackRdsReceiver); // StreamOffset.create(SQL_PERFORMANCE_LACK.getKey(), ReadOffset.lastConsumed()), consumerKylinSqlPerformanceLackRdsReceiver);
} // }
//
/* —————————————————————————— | —————————————————————————— | —————————————————————————— */ // /* —————————————————————————— | —————————————————————————— | —————————————————————————— */
//
/* -------------------------------------------------------- | 缺票登记 */ // /* -------------------------------------------------------- | 缺票登记 */
//
@Bean // @Bean
public Subscription subscriptionSqlPerformanceLack0(RedisConnectionFactory factory) { // public Subscription subscriptionSqlPerformanceLack0(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory); // var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receiveSqlPerformanceLack(listenerContainer, 0); // var subscription = receiveSqlPerformanceLack(listenerContainer, 0);
listenerContainer.start(); // listenerContainer.start();
return subscription; // return subscription;
} // }
//
/* -------------------------------------------------------- | */ // /* -------------------------------------------------------- | */
} //}
package com.liquidnet.service.consumer.slowly.config; //package com.liquidnet.service.consumer.slowly.config;
import com.liquidnet.common.cache.redis.config.RedisStreamConfig;
import com.liquidnet.service.consumer.slowly.receiver.ConsumerKylinTransferRdsReceiver;
import lombok.var;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.stream.Consumer;
import org.springframework.data.redis.connection.stream.MapRecord;
import org.springframework.data.redis.connection.stream.ReadOffset;
import org.springframework.data.redis.connection.stream.StreamOffset;
import org.springframework.data.redis.stream.StreamMessageListenerContainer;
import org.springframework.data.redis.stream.Subscription;
import static com.liquidnet.service.base.constant.MQConst.KylinQueue.SQL_TRANSFER;
@Configuration
public class ConsumerKylinSqlTransferRedisStreamConfig extends RedisStreamConfig {
@Autowired
ConsumerKylinTransferRdsReceiver consumerKylinTransferRdsReceiver;
/**
* 验票更新
*
* @param listenerContainer
* @param t
* @return
*/
private Subscription receiveTransfer(StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer, int t) {
return listenerContainer.receiveAutoAck(Consumer.from(SQL_TRANSFER.getGroup(), getConsumerName(SQL_TRANSFER.name() + t)),
StreamOffset.create(SQL_TRANSFER.getKey(), ReadOffset.lastConsumed()), consumerKylinTransferRdsReceiver);
}
/* —————————————————————————— | —————————————————————————— | —————————————————————————— */
/* -------------------------------------------------------- | 验票更新 */
@Bean
public Subscription subscriptionReceiveTransfer0(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receiveTransfer(listenerContainer, 0);
listenerContainer.start();
return subscription;
}
// @Bean
// public Subscription subscriptionReceiveTransfer1(RedisConnectionFactory factory) {
// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
// var subscription = receiveTransfer(listenerContainer, 1);
// listenerContainer.start();
// return subscription;
// }
// //
// @Bean //import com.liquidnet.common.cache.redis.config.RedisStreamConfig;
// public Subscription subscriptionReceiveTransfer2(RedisConnectionFactory factory) { //import com.liquidnet.service.consumer.slowly.receiver.ConsumerKylinTransferRdsReceiver;
// var listenerContainer = this.buildStreamMessageListenerContainer(factory); //import lombok.var;
// var subscription = receiveTransfer(listenerContainer, 2); //import org.springframework.beans.factory.annotation.Autowired;
// listenerContainer.start(); //import org.springframework.context.annotation.Bean;
// return subscription; //import org.springframework.context.annotation.Configuration;
// } //import org.springframework.data.redis.connection.RedisConnectionFactory;
//import org.springframework.data.redis.connection.stream.Consumer;
// @Bean //import org.springframework.data.redis.connection.stream.MapRecord;
// public Subscription subscriptionReceiveTransfer3(RedisConnectionFactory factory) { //import org.springframework.data.redis.connection.stream.ReadOffset;
// var listenerContainer = this.buildStreamMessageListenerContainer(factory); //import org.springframework.data.redis.connection.stream.StreamOffset;
// var subscription = receiveTransfer(listenerContainer, 3); //import org.springframework.data.redis.stream.StreamMessageListenerContainer;
// listenerContainer.start(); //import org.springframework.data.redis.stream.Subscription;
// return subscription; //
//import static com.liquidnet.service.base.constant.MQConst.KylinQueue.SQL_TRANSFER;
//
//@Configuration
//public class ConsumerKylinSqlTransferRedisStreamConfig extends RedisStreamConfig {
// @Autowired
// ConsumerKylinTransferRdsReceiver consumerKylinTransferRdsReceiver;
//
// /**
// * 验票更新
// *
// * @param listenerContainer
// * @param t
// * @return
// */
// private Subscription receiveTransfer(StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer, int t) {
// return listenerContainer.receiveAutoAck(Consumer.from(SQL_TRANSFER.getGroup(), getConsumerName(SQL_TRANSFER.name() + t)),
// StreamOffset.create(SQL_TRANSFER.getKey(), ReadOffset.lastConsumed()), consumerKylinTransferRdsReceiver);
// } // }
// //
// /* —————————————————————————— | —————————————————————————— | —————————————————————————— */
//
// /* -------------------------------------------------------- | 验票更新 */
//
// @Bean // @Bean
// public Subscription subscriptionReceiveTransfer4(RedisConnectionFactory factory) { // public Subscription subscriptionReceiveTransfer0(RedisConnectionFactory factory) {
// var listenerContainer = this.buildStreamMessageListenerContainer(factory); // var listenerContainer = this.buildStreamMessageListenerContainer(factory);
// var subscription = receiveTransfer(listenerContainer, 4); // var subscription = receiveTransfer(listenerContainer, 0);
// listenerContainer.start(); // listenerContainer.start();
// return subscription; // return subscription;
// } // }
//
/* -------------------------------------------------------- | */ //// @Bean
} //// public Subscription subscriptionReceiveTransfer1(RedisConnectionFactory factory) {
//// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
//// var subscription = receiveTransfer(listenerContainer, 1);
//// listenerContainer.start();
//// return subscription;
//// }
////
//// @Bean
//// public Subscription subscriptionReceiveTransfer2(RedisConnectionFactory factory) {
//// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
//// var subscription = receiveTransfer(listenerContainer, 2);
//// listenerContainer.start();
//// return subscription;
//// }
//
//// @Bean
//// public Subscription subscriptionReceiveTransfer3(RedisConnectionFactory factory) {
//// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
//// var subscription = receiveTransfer(listenerContainer, 3);
//// listenerContainer.start();
//// return subscription;
//// }
////
//// @Bean
//// public Subscription subscriptionReceiveTransfer4(RedisConnectionFactory factory) {
//// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
//// var subscription = receiveTransfer(listenerContainer, 4);
//// listenerContainer.start();
//// return subscription;
//// }
//
// /* -------------------------------------------------------- | */
//}
package com.liquidnet.service.consumer.slowly.config; //package com.liquidnet.service.consumer.slowly.config;
import com.liquidnet.common.cache.redis.config.RedisStreamConfig;
import com.liquidnet.service.consumer.slowly.receiver.ConsumerKylinTransferResultRdsReceiver;
import lombok.var;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.stream.Consumer;
import org.springframework.data.redis.connection.stream.MapRecord;
import org.springframework.data.redis.connection.stream.ReadOffset;
import org.springframework.data.redis.connection.stream.StreamOffset;
import org.springframework.data.redis.stream.StreamMessageListenerContainer;
import org.springframework.data.redis.stream.Subscription;
import static com.liquidnet.service.base.constant.MQConst.KylinQueue.SQL_TRANSFER_RESULT;
@Configuration
public class ConsumerKylinSqlTransferResultRedisStreamConfig extends RedisStreamConfig {
@Autowired
ConsumerKylinTransferResultRdsReceiver consumerKylinTransferResultRdsReceiver;
/**
* 验票更新
*
* @param listenerContainer
* @param t
* @return
*/
private Subscription receiveTransferResult(StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer, int t) {
return listenerContainer.receiveAutoAck(Consumer.from(SQL_TRANSFER_RESULT.getGroup(), getConsumerName(SQL_TRANSFER_RESULT.name() + t)),
StreamOffset.create(SQL_TRANSFER_RESULT.getKey(), ReadOffset.lastConsumed()), consumerKylinTransferResultRdsReceiver);
}
/* —————————————————————————— | —————————————————————————— | —————————————————————————— */
/* -------------------------------------------------------- | 验票更新 */
@Bean
public Subscription subscriptionReceiveTransferResult0(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receiveTransferResult(listenerContainer, 0);
listenerContainer.start();
return subscription;
}
// @Bean
// public Subscription subscriptionReceiveTransferResult1(RedisConnectionFactory factory) {
// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
// var subscription = receiveTransferResult(listenerContainer, 1);
// listenerContainer.start();
// return subscription;
// }
// //
// @Bean //import com.liquidnet.common.cache.redis.config.RedisStreamConfig;
// public Subscription subscriptionReceiveTransferResult2(RedisConnectionFactory factory) { //import com.liquidnet.service.consumer.slowly.receiver.ConsumerKylinTransferResultRdsReceiver;
// var listenerContainer = this.buildStreamMessageListenerContainer(factory); //import lombok.var;
// var subscription = receiveTransferResult(listenerContainer, 2); //import org.springframework.beans.factory.annotation.Autowired;
// listenerContainer.start(); //import org.springframework.context.annotation.Bean;
// return subscription; //import org.springframework.context.annotation.Configuration;
// } //import org.springframework.data.redis.connection.RedisConnectionFactory;
//import org.springframework.data.redis.connection.stream.Consumer;
// @Bean //import org.springframework.data.redis.connection.stream.MapRecord;
// public Subscription subscriptionReceiveTransferResult3(RedisConnectionFactory factory) { //import org.springframework.data.redis.connection.stream.ReadOffset;
// var listenerContainer = this.buildStreamMessageListenerContainer(factory); //import org.springframework.data.redis.connection.stream.StreamOffset;
// var subscription = receiveTransferResult(listenerContainer, 3); //import org.springframework.data.redis.stream.StreamMessageListenerContainer;
// listenerContainer.start(); //import org.springframework.data.redis.stream.Subscription;
// return subscription; //
//import static com.liquidnet.service.base.constant.MQConst.KylinQueue.SQL_TRANSFER_RESULT;
//
//@Configuration
//public class ConsumerKylinSqlTransferResultRedisStreamConfig extends RedisStreamConfig {
// @Autowired
// ConsumerKylinTransferResultRdsReceiver consumerKylinTransferResultRdsReceiver;
//
// /**
// * 验票更新
// *
// * @param listenerContainer
// * @param t
// * @return
// */
// private Subscription receiveTransferResult(StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer, int t) {
// return listenerContainer.receiveAutoAck(Consumer.from(SQL_TRANSFER_RESULT.getGroup(), getConsumerName(SQL_TRANSFER_RESULT.name() + t)),
// StreamOffset.create(SQL_TRANSFER_RESULT.getKey(), ReadOffset.lastConsumed()), consumerKylinTransferResultRdsReceiver);
// } // }
// //
// /* —————————————————————————— | —————————————————————————— | —————————————————————————— */
//
// /* -------------------------------------------------------- | 验票更新 */
//
// @Bean // @Bean
// public Subscription subscriptionReceiveTransferResult4(RedisConnectionFactory factory) { // public Subscription subscriptionReceiveTransferResult0(RedisConnectionFactory factory) {
// var listenerContainer = this.buildStreamMessageListenerContainer(factory); // var listenerContainer = this.buildStreamMessageListenerContainer(factory);
// var subscription = receiveTransferResult(listenerContainer, 4); // var subscription = receiveTransferResult(listenerContainer, 0);
// listenerContainer.start(); // listenerContainer.start();
// return subscription; // return subscription;
// } // }
//
/* -------------------------------------------------------- | */ //// @Bean
} //// public Subscription subscriptionReceiveTransferResult1(RedisConnectionFactory factory) {
//// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
//// var subscription = receiveTransferResult(listenerContainer, 1);
//// listenerContainer.start();
//// return subscription;
//// }
////
//// @Bean
//// public Subscription subscriptionReceiveTransferResult2(RedisConnectionFactory factory) {
//// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
//// var subscription = receiveTransferResult(listenerContainer, 2);
//// listenerContainer.start();
//// return subscription;
//// }
//
//// @Bean
//// public Subscription subscriptionReceiveTransferResult3(RedisConnectionFactory factory) {
//// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
//// var subscription = receiveTransferResult(listenerContainer, 3);
//// listenerContainer.start();
//// return subscription;
//// }
////
//// @Bean
//// public Subscription subscriptionReceiveTransferResult4(RedisConnectionFactory factory) {
//// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
//// var subscription = receiveTransferResult(listenerContainer, 4);
//// listenerContainer.start();
//// return subscription;
//// }
//
// /* -------------------------------------------------------- | */
//}
package com.liquidnet.service.consumer.slowly.receiver; //package com.liquidnet.service.consumer.slowly.receiver;
//
import com.liquidnet.service.base.constant.MQConst; //import com.liquidnet.service.base.constant.MQConst;
import org.springframework.stereotype.Component; //import org.springframework.stereotype.Component;
//
@Component //@Component
public class ConsumerGoblinOrderCloseRdsReceiver extends AbstractSqlRedisReceiver { //public class ConsumerGoblinOrderCloseRdsReceiver extends AbstractSqlRedisReceiver {
@Override // @Override
protected String getRedisStreamKey() { // protected String getRedisStreamKey() {
return MQConst.GoblinQueue.GOBLIN_ORDER_CLOSE.getKey(); // return MQConst.GoblinQueue.GOBLIN_ORDER_CLOSE.getKey();
} // }
//
@Override // @Override
protected String getRedisStreamGroup() { // protected String getRedisStreamGroup() {
return MQConst.GoblinQueue.GOBLIN_ORDER_CLOSE.getGroup(); // return MQConst.GoblinQueue.GOBLIN_ORDER_CLOSE.getGroup();
} // }
} //}
package com.liquidnet.service.consumer.slowly.receiver; //package com.liquidnet.service.consumer.slowly.receiver;
//
import com.liquidnet.service.base.constant.MQConst; //import com.liquidnet.service.base.constant.MQConst;
import org.springframework.stereotype.Component; //import org.springframework.stereotype.Component;
//
@Component //@Component
public class ConsumerGoblinSelfMarketRdsReceiver extends AbstractSqlRedisReceiver { //public class ConsumerGoblinSelfMarketRdsReceiver extends AbstractSqlRedisReceiver {
@Override // @Override
protected String getRedisStreamKey() { // protected String getRedisStreamKey() {
return MQConst.GoblinQueue.GOBLIN_SELF_MARKET.getKey(); // return MQConst.GoblinQueue.GOBLIN_SELF_MARKET.getKey();
} // }
//
@Override // @Override
protected String getRedisStreamGroup() { // protected String getRedisStreamGroup() {
return MQConst.GoblinQueue.GOBLIN_SELF_MARKET.getGroup(); // return MQConst.GoblinQueue.GOBLIN_SELF_MARKET.getGroup();
} // }
} //}
package com.liquidnet.service.consumer.slowly.receiver; //package com.liquidnet.service.consumer.slowly.receiver;
//
import com.liquidnet.service.base.constant.MQConst; //import com.liquidnet.service.base.constant.MQConst;
import org.springframework.stereotype.Component; //import org.springframework.stereotype.Component;
//
@Component //@Component
public class ConsumerGoblinShopCartReceiver extends AbstractSqlRedisReceiver { //public class ConsumerGoblinShopCartReceiver extends AbstractSqlRedisReceiver {
@Override // @Override
protected String getRedisStreamKey() { // protected String getRedisStreamKey() {
return MQConst.GoblinQueue.GOBLIN_SHOP_CART.getKey(); // return MQConst.GoblinQueue.GOBLIN_SHOP_CART.getKey();
} // }
//
@Override // @Override
protected String getRedisStreamGroup() { // protected String getRedisStreamGroup() {
return MQConst.GoblinQueue.GOBLIN_SHOP_CART.getGroup(); // return MQConst.GoblinQueue.GOBLIN_SHOP_CART.getGroup();
} // }
} //}
package com.liquidnet.service.consumer.slowly.receiver; //package com.liquidnet.service.consumer.slowly.receiver;
//
import com.liquidnet.service.base.constant.MQConst; //import com.liquidnet.service.base.constant.MQConst;
import org.springframework.stereotype.Component; //import org.springframework.stereotype.Component;
//
@Component //@Component
public class ConsumerGoblinStoreMarketRdsReceiver extends AbstractSqlRedisReceiver { //public class ConsumerGoblinStoreMarketRdsReceiver extends AbstractSqlRedisReceiver {
@Override // @Override
protected String getRedisStreamKey() { // protected String getRedisStreamKey() {
return MQConst.GoblinQueue.GOBLIN_STORE_MARKET.getKey(); // return MQConst.GoblinQueue.GOBLIN_STORE_MARKET.getKey();
} // }
//
@Override // @Override
protected String getRedisStreamGroup() { // protected String getRedisStreamGroup() {
return MQConst.GoblinQueue.GOBLIN_STORE_MARKET.getGroup(); // return MQConst.GoblinQueue.GOBLIN_STORE_MARKET.getGroup();
} // }
} //}
package com.liquidnet.service.consumer.slowly.receiver; //package com.liquidnet.service.consumer.slowly.receiver;
//
import com.liquidnet.service.base.constant.MQConst; //import com.liquidnet.service.base.constant.MQConst;
import org.springframework.stereotype.Component; //import org.springframework.stereotype.Component;
//
@Component //@Component
public class ConsumerGoblinStoreOrderRdsReceiver extends AbstractSqlRedisReceiver { //public class ConsumerGoblinStoreOrderRdsReceiver extends AbstractSqlRedisReceiver {
@Override // @Override
protected String getRedisStreamKey() { // protected String getRedisStreamKey() {
return MQConst.GoblinQueue.GOBLIN_STORE_ORDER_OPERA.getKey(); // return MQConst.GoblinQueue.GOBLIN_STORE_ORDER_OPERA.getKey();
} // }
//
@Override // @Override
protected String getRedisStreamGroup() { // protected String getRedisStreamGroup() {
return MQConst.GoblinQueue.GOBLIN_STORE_ORDER_OPERA.getGroup(); // return MQConst.GoblinQueue.GOBLIN_STORE_ORDER_OPERA.getGroup();
} // }
} //}
package com.liquidnet.service.consumer.slowly.receiver; //package com.liquidnet.service.consumer.slowly.receiver;
//
import com.liquidnet.service.base.constant.MQConst; //import com.liquidnet.service.base.constant.MQConst;
import org.springframework.stereotype.Component; //import org.springframework.stereotype.Component;
//
@Component //@Component
public class ConsumerGoblinUserOrderRdsReceiver extends AbstractSqlRedisReceiver { //public class ConsumerGoblinUserOrderRdsReceiver extends AbstractSqlRedisReceiver {
@Override // @Override
protected String getRedisStreamKey() { // protected String getRedisStreamKey() {
return MQConst.GoblinQueue.GOBLIN_USER_ORDER_OPERA.getKey(); // return MQConst.GoblinQueue.GOBLIN_USER_ORDER_OPERA.getKey();
} // }
//
@Override // @Override
protected String getRedisStreamGroup() { // protected String getRedisStreamGroup() {
return MQConst.GoblinQueue.GOBLIN_USER_ORDER_OPERA.getGroup(); // return MQConst.GoblinQueue.GOBLIN_USER_ORDER_OPERA.getGroup();
} // }
} //}
package com.liquidnet.service.consumer.slowly.receiver; //package com.liquidnet.service.consumer.slowly.receiver;
//
import com.liquidnet.service.base.constant.MQConst; //import com.liquidnet.service.base.constant.MQConst;
import org.springframework.stereotype.Component; //import org.springframework.stereotype.Component;
//
@Component //@Component
public class ConsumerKylinSqlOrderWithdrawRdsReceiver extends AbstractSqlRedisReceiver { //public class ConsumerKylinSqlOrderWithdrawRdsReceiver extends AbstractSqlRedisReceiver {
@Override // @Override
protected String getRedisStreamKey() { // protected String getRedisStreamKey() {
return MQConst.KylinQueue.SQL_ORDER_WITHDRAW.getKey(); // return MQConst.KylinQueue.SQL_ORDER_WITHDRAW.getKey();
} // }
//
@Override // @Override
protected String getRedisStreamGroup() { // protected String getRedisStreamGroup() {
return MQConst.KylinQueue.SQL_ORDER_WITHDRAW.getGroup(); // return MQConst.KylinQueue.SQL_ORDER_WITHDRAW.getGroup();
} // }
} //}
package com.liquidnet.service.consumer.slowly.receiver; //package com.liquidnet.service.consumer.slowly.receiver;
//
import com.liquidnet.service.base.constant.MQConst; //import com.liquidnet.service.base.constant.MQConst;
import org.springframework.stereotype.Component; //import org.springframework.stereotype.Component;
//
@Component //@Component
public class ConsumerKylinSqlPerformanceLackRdsReceiver extends AbstractSqlRedisReceiver { //public class ConsumerKylinSqlPerformanceLackRdsReceiver extends AbstractSqlRedisReceiver {
@Override // @Override
protected String getRedisStreamKey() { // protected String getRedisStreamKey() {
return MQConst.KylinQueue.SQL_PERFORMANCE_LACK.getKey(); // return MQConst.KylinQueue.SQL_PERFORMANCE_LACK.getKey();
} // }
//
@Override // @Override
protected String getRedisStreamGroup() { // protected String getRedisStreamGroup() {
return MQConst.KylinQueue.SQL_PERFORMANCE_LACK.getGroup(); // return MQConst.KylinQueue.SQL_PERFORMANCE_LACK.getGroup();
} // }
} //}
package com.liquidnet.service.consumer.slowly.receiver; //package com.liquidnet.service.consumer.slowly.receiver;
//
import com.liquidnet.service.base.constant.MQConst; //import com.liquidnet.service.base.constant.MQConst;
import org.springframework.stereotype.Component; //import org.springframework.stereotype.Component;
//
@Component //@Component
public class ConsumerKylinTransferRdsReceiver extends AbstractSqlRedisReceiver { //public class ConsumerKylinTransferRdsReceiver extends AbstractSqlRedisReceiver {
@Override // @Override
protected String getRedisStreamKey() { // protected String getRedisStreamKey() {
return MQConst.KylinQueue.SQL_TRANSFER.getKey(); // return MQConst.KylinQueue.SQL_TRANSFER.getKey();
} // }
//
@Override // @Override
protected String getRedisStreamGroup() { // protected String getRedisStreamGroup() {
return MQConst.KylinQueue.SQL_TRANSFER.getGroup(); // return MQConst.KylinQueue.SQL_TRANSFER.getGroup();
} // }
} //}
package com.liquidnet.service.consumer.slowly.receiver; //package com.liquidnet.service.consumer.slowly.receiver;
//
import com.liquidnet.service.base.constant.MQConst; //import com.liquidnet.service.base.constant.MQConst;
import org.springframework.stereotype.Component; //import org.springframework.stereotype.Component;
//
@Component //@Component
public class ConsumerKylinTransferResultRdsReceiver extends AbstractSqlRedisReceiver { //public class ConsumerKylinTransferResultRdsReceiver extends AbstractSqlRedisReceiver {
@Override // @Override
protected String getRedisStreamKey() { // protected String getRedisStreamKey() {
return MQConst.KylinQueue.SQL_TRANSFER_RESULT.getKey(); // return MQConst.KylinQueue.SQL_TRANSFER_RESULT.getKey();
} // }
//
@Override // @Override
protected String getRedisStreamGroup() { // protected String getRedisStreamGroup() {
return MQConst.KylinQueue.SQL_TRANSFER_RESULT.getGroup(); // return MQConst.KylinQueue.SQL_TRANSFER_RESULT.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