记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
董敬伟
liquidnet-bus-v1
Commits
7b6cc0ae
Commit
7b6cc0ae
authored
Jun 15, 2022
by
anjiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nft-sql队列迁移
parent
35a8f441
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
80 additions
and
43 deletions
+80
-43
ConsumerCommonSqlRedisStreamConfig.java
...sumer/base/config/ConsumerCommonSqlRedisStreamConfig.java
+37
-0
ConsumerCommonSqlRedisStreamConfig.java
...nsumer/nft/config/ConsumerCommonSqlRedisStreamConfig.java
+43
-43
No files found.
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-base/src/main/java/com/liquidnet/service/consumer/base/config/ConsumerCommonSqlRedisStreamConfig.java
View file @
7b6cc0ae
package
com
.
liquidnet
.
service
.
consumer
.
base
.
config
;
package
com
.
liquidnet
.
service
.
consumer
.
base
.
config
;
import
com.liquidnet.common.cache.redis.config.RedisStreamConfig
;
import
com.liquidnet.common.cache.redis.config.RedisStreamConfig
;
import
com.liquidnet.service.base.constant.MQConst
;
import
com.liquidnet.service.consumer.base.receiver.ConsumerCommonSQL0Receiver
;
import
com.liquidnet.service.consumer.base.receiver.ConsumerCommonSQL0Receiver
;
import
com.liquidnet.service.consumer.base.receiver.ConsumerGoblinNftOrderRdsReceiver
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
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.core.StringRedisTemplate
;
import
org.springframework.data.redis.stream.StreamMessageListenerContainer
;
import
org.springframework.data.redis.stream.Subscription
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
/**
* 公共的SQL队列消息消费器初始化配置
* 公共的SQL队列消息消费器初始化配置
...
@@ -19,6 +32,30 @@ public class ConsumerCommonSqlRedisStreamConfig extends RedisStreamConfig {
...
@@ -19,6 +32,30 @@ public class ConsumerCommonSqlRedisStreamConfig extends RedisStreamConfig {
@Autowired
@Autowired
ConsumerCommonSQL0Receiver
consumerCommonSQL0Receiver
;
ConsumerCommonSQL0Receiver
consumerCommonSQL0Receiver
;
@Autowired
ConsumerGoblinNftOrderRdsReceiver
consumerGoblinNftOrderRdsReceiver
;
/**
* goblinNFT订单
* @param factory
* @return
*/
@Bean
// NFT订单
public
List
<
Subscription
>
subscriptionSqlNftOrder
(
RedisConnectionFactory
factory
)
{
List
<
Subscription
>
subscriptionList
=
new
ArrayList
<>();
MQConst
.
GoblinQueue
stream
=
MQConst
.
GoblinQueue
.
GOBLIN_NFT_ORDER
;
this
.
initStream
(
stringRedisTemplate
,
stream
.
getKey
(),
stream
.
getGroup
());
for
(
int
i
=
0
;
i
<
20
;
i
++)
{
StreamMessageListenerContainer
<
String
,
MapRecord
<
String
,
String
,
String
>>
listenerContainer
=
this
.
buildStreamMessageListenerContainer
(
factory
);
subscriptionList
.
add
(
listenerContainer
.
receiveAutoAck
(
Consumer
.
from
(
stream
.
getGroup
(),
getConsumerName
(
stream
.
name
()
+
i
)),
StreamOffset
.
create
(
stream
.
getKey
(),
ReadOffset
.
lastConsumed
()),
consumerGoblinNftOrderRdsReceiver
));
listenerContainer
.
start
();
}
return
subscriptionList
;
}
// @Bean
// @Bean
// public List<Subscription> subscriptionSQL0(RedisConnectionFactory factory) {
// public List<Subscription> subscriptionSQL0(RedisConnectionFactory factory) {
// List<Subscription> subscriptionList = new ArrayList<>();
// List<Subscription> subscriptionList = new ArrayList<>();
...
...
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-nft/src/main/java/com/liquidnet/service/consumer/nft/config/ConsumerCommonSqlRedisStreamConfig.java
View file @
7b6cc0ae
package
com
.
liquidnet
.
service
.
consumer
.
nft
.
config
;
//
package com.liquidnet.service.consumer.nft.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.nft.receiver.ConsumerGoblinNftOrderRdsReceiver
;
//
import com.liquidnet.service.consumer.nft.receiver.ConsumerGoblinNftOrderRdsReceiver;
import
org.springframework.beans.factory.annotation.Autowired
;
//
import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.context.annotation.Bean
;
//
import org.springframework.context.annotation.Bean;
import
org.springframework.context.annotation.Configuration
;
//
import org.springframework.context.annotation.Configuration;
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.core.StringRedisTemplate
;
//
import org.springframework.data.redis.core.StringRedisTemplate;
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
java.util.ArrayList
;
//
import java.util.ArrayList;
import
java.util.List
;
//
import java.util.List;
//
@Configuration
//
@Configuration
public
class
ConsumerCommonSqlRedisStreamConfig
extends
RedisStreamConfig
{
//
public class ConsumerCommonSqlRedisStreamConfig extends RedisStreamConfig {
@Autowired
//
@Autowired
StringRedisTemplate
stringRedisTemplate
;
//
StringRedisTemplate stringRedisTemplate;
@Autowired
//
@Autowired
ConsumerGoblinNftOrderRdsReceiver
consumerGoblinNftOrderRdsReceiver
;
//
ConsumerGoblinNftOrderRdsReceiver consumerGoblinNftOrderRdsReceiver;
//
@Bean
// NFT订单
//
@Bean// NFT订单
public
List
<
Subscription
>
subscriptionSqlNftOrder
(
RedisConnectionFactory
factory
)
{
//
public List<Subscription> subscriptionSqlNftOrder(RedisConnectionFactory factory) {
List
<
Subscription
>
subscriptionList
=
new
ArrayList
<>();
//
List<Subscription> subscriptionList = new ArrayList<>();
MQConst
.
GoblinQueue
stream
=
MQConst
.
GoblinQueue
.
GOBLIN_NFT_ORDER
;
//
MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_NFT_ORDER;
this
.
initStream
(
stringRedisTemplate
,
stream
.
getKey
(),
stream
.
getGroup
());
//
this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup());
for
(
int
i
=
0
;
i
<
20
;
i
++)
{
//
for (int i = 0; i < 20; i++) {
StreamMessageListenerContainer
<
String
,
MapRecord
<
String
,
String
,
String
>>
listenerContainer
=
this
.
buildStreamMessageListenerContainer
(
factory
);
//
StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory);
subscriptionList
.
add
(
listenerContainer
.
receiveAutoAck
(
//
subscriptionList.add(listenerContainer.receiveAutoAck(
Consumer
.
from
(
stream
.
getGroup
(),
getConsumerName
(
stream
.
name
()
+
i
)),
//
Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)),
StreamOffset
.
create
(
stream
.
getKey
(),
ReadOffset
.
lastConsumed
()),
consumerGoblinNftOrderRdsReceiver
//
StreamOffset.create(stream.getKey(), ReadOffset.lastConsumed()), consumerGoblinNftOrderRdsReceiver
));
//
));
listenerContainer
.
start
();
//
listenerContainer.start();
}
//
}
return
subscriptionList
;
//
return subscriptionList;
}
//
}
}
//
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment