记得上下班打卡 | 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
c6129d33
Commit
c6129d33
authored
Apr 06, 2022
by
张国柄
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
opt;
parent
9131e43f
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
252 additions
and
198 deletions
+252
-198
RedisStreamConfig.java
...iquidnet.common.cache/redis/config/RedisStreamConfig.java
+2
-1
ConsumerCommonSqlRedisStreamConfig.java
...umer/kylin/config/ConsumerCommonSqlRedisStreamConfig.java
+56
-3
ConsumerGoblinSqlUstoreRedisStreamConfig.java
...ylin/config/ConsumerGoblinSqlUstoreRedisStreamConfig.java
+194
-194
No files found.
liquidnet-bus-common/liquidnet-common-cache/liquidnet-common-cache-redis/src/main/java/com.liquidnet.common.cache/redis/config/RedisStreamConfig.java
View file @
c6129d33
...
@@ -33,6 +33,7 @@ public class RedisStreamConfig {
...
@@ -33,6 +33,7 @@ public class RedisStreamConfig {
try
{
try
{
if
(
stringRedisTemplate
.
hasKey
(
key
))
{
if
(
stringRedisTemplate
.
hasKey
(
key
))
{
log
.
info
(
"redis stream exist[{},{}]"
,
key
,
group
);
log
.
info
(
"redis stream exist[{},{}]"
,
key
,
group
);
stringRedisTemplate
.
opsForStream
().
createGroup
(
key
,
group
);
}
else
{
}
else
{
log
.
info
(
"redis stream init[{},{}]"
,
key
,
group
);
log
.
info
(
"redis stream init[{},{}]"
,
key
,
group
);
HashMap
<
String
,
String
>
map
=
new
HashMap
<>();
HashMap
<
String
,
String
>
map
=
new
HashMap
<>();
...
@@ -43,7 +44,7 @@ public class RedisStreamConfig {
...
@@ -43,7 +44,7 @@ public class RedisStreamConfig {
stringObjectObjectStreamOperations
.
delete
(
key
,
recordId
.
getValue
());
stringObjectObjectStreamOperations
.
delete
(
key
,
recordId
.
getValue
());
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"Ex:redis stream init [{},{}]
"
,
key
,
group
,
e
);
log
.
error
(
"Ex:redis stream init [{},{}]
,ex:{}"
,
key
,
group
,
e
.
getMessage
()
);
}
}
}
}
...
...
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-kylin/src/main/java/com/liquidnet/service/consumer/kylin/config/ConsumerCommonSqlRedisStreamConfig.java
View file @
c6129d33
...
@@ -2,8 +2,7 @@ package com.liquidnet.service.consumer.kylin.config;
...
@@ -2,8 +2,7 @@ package com.liquidnet.service.consumer.kylin.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.kylin.receiver.ConsumerGoblinNftOrderRdsReceiver
;
import
com.liquidnet.service.consumer.kylin.receiver.*
;
import
com.liquidnet.service.consumer.kylin.receiver.ConsumerGoblinSqlArtworkGenRdsReceiver
;
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
;
...
@@ -24,10 +23,64 @@ public class ConsumerCommonSqlRedisStreamConfig extends RedisStreamConfig {
...
@@ -24,10 +23,64 @@ public class ConsumerCommonSqlRedisStreamConfig extends RedisStreamConfig {
@Autowired
@Autowired
StringRedisTemplate
stringRedisTemplate
;
StringRedisTemplate
stringRedisTemplate
;
@Autowired
@Autowired
ConsumerGoblinSqlStoreRdsReceiver
consumerGoblinSqlStoreRdsReceiver
;
@Autowired
ConsumerGoblinSqlGoodsRdsReceiver
consumerGoblinSqlGoodsRdsReceiver
;
@Autowired
ConsumerGoblinSqlCouponRdsReceiver
consumerGoblinSqlCouponRdsReceiver
;
@Autowired
ConsumerGoblinSqlArtworkGenRdsReceiver
consumerGoblinSqlArtworkGenRdsReceiver
;
ConsumerGoblinSqlArtworkGenRdsReceiver
consumerGoblinSqlArtworkGenRdsReceiver
;
@Autowired
@Autowired
ConsumerGoblinNftOrderRdsReceiver
consumerGoblinNftOrderRdsReceiver
;
ConsumerGoblinNftOrderRdsReceiver
consumerGoblinNftOrderRdsReceiver
;
@Bean
// 店铺相关
public
List
<
Subscription
>
subscriptionSqlStore
(
RedisConnectionFactory
factory
)
{
List
<
Subscription
>
subscriptionList
=
new
ArrayList
<>();
MQConst
.
GoblinQueue
stream
=
MQConst
.
GoblinQueue
.
SQL_STORE
;
this
.
initStream
(
stringRedisTemplate
,
stream
.
getKey
(),
stream
.
getGroup
());
for
(
int
i
=
0
;
i
<
2
;
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
()),
consumerGoblinSqlStoreRdsReceiver
));
listenerContainer
.
start
();
}
return
subscriptionList
;
}
@Bean
// 商品相关
public
List
<
Subscription
>
subscriptionSqlGoods
(
RedisConnectionFactory
factory
)
{
List
<
Subscription
>
subscriptionList
=
new
ArrayList
<>();
MQConst
.
GoblinQueue
stream
=
MQConst
.
GoblinQueue
.
SQL_GOODS
;
this
.
initStream
(
stringRedisTemplate
,
stream
.
getKey
(),
stream
.
getGroup
());
for
(
int
i
=
0
;
i
<
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
()),
consumerGoblinSqlGoodsRdsReceiver
));
listenerContainer
.
start
();
}
return
subscriptionList
;
}
@Bean
// 店铺优惠券相关
public
List
<
Subscription
>
subscriptionSqlStoreCoupon
(
RedisConnectionFactory
factory
)
{
List
<
Subscription
>
subscriptionList
=
new
ArrayList
<>();
MQConst
.
GoblinQueue
stream
=
MQConst
.
GoblinQueue
.
SQL_COUPON
;
this
.
initStream
(
stringRedisTemplate
,
stream
.
getKey
(),
stream
.
getGroup
());
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
StreamMessageListenerContainer
<
String
,
MapRecord
<
String
,
String
,
String
>>
listenerContainer
=
this
.
buildStreamMessageListenerContainer
(
factory
);
subscriptionList
.
add
(
listenerContainer
.
receiveAutoAck
(
Consumer
.
from
(
stream
.
getGroup
(),
getConsumerName
(
stream
.
name
()
+
i
)),
StreamOffset
.
create
(
stream
.
getKey
(),
ReadOffset
.
lastConsumed
()),
consumerGoblinSqlCouponRdsReceiver
));
listenerContainer
.
start
();
}
return
subscriptionList
;
}
@Bean
// 藏品生成
@Bean
// 藏品生成
public
List
<
Subscription
>
subscriptionSqlArtworkGen
(
RedisConnectionFactory
factory
)
{
public
List
<
Subscription
>
subscriptionSqlArtworkGen
(
RedisConnectionFactory
factory
)
{
List
<
Subscription
>
subscriptionList
=
new
ArrayList
<>();
List
<
Subscription
>
subscriptionList
=
new
ArrayList
<>();
...
@@ -45,7 +98,7 @@ public class ConsumerCommonSqlRedisStreamConfig extends RedisStreamConfig {
...
@@ -45,7 +98,7 @@ public class ConsumerCommonSqlRedisStreamConfig extends RedisStreamConfig {
}
}
@Bean
// NFT订单
@Bean
// NFT订单
public
List
<
Subscription
>
subscription
Biz
NftOrder
(
RedisConnectionFactory
factory
)
{
public
List
<
Subscription
>
subscription
Sql
NftOrder
(
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
());
...
...
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-kylin/src/main/java/com/liquidnet/service/consumer/kylin/config/ConsumerGoblinSqlUstoreRedisStreamConfig.java
View file @
c6129d33
This diff is collapsed.
Click to expand it.
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