记得上下班打卡 | 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
b9aa793d
Commit
b9aa793d
authored
Jul 21, 2022
by
胡佳晨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改 redis队列消费指定 db
parent
dff5eb31
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
19 deletions
+26
-19
AbstractRedisConfig.java
...uidnet.common.cache/redis/config/AbstractRedisConfig.java
+9
-2
MQConst.java
...ain/java/com/liquidnet/service/base/constant/MQConst.java
+10
-10
application-test.yml
liquidnet-bus-config/liquidnet-config/application-test.yml
+7
-7
No files found.
liquidnet-bus-common/liquidnet-common-cache/liquidnet-common-cache-redis/src/main/java/com.liquidnet.common.cache/redis/config/AbstractRedisConfig.java
View file @
b9aa793d
...
...
@@ -37,6 +37,8 @@ public abstract class AbstractRedisConfig {
public
int
totalDbs
=
1
;
public
int
stringTemplateDb
=
1
;
public
Map
<
Integer
,
RedisTemplate
<
String
,
Object
>>
redisTemplateMap
=
new
HashMap
<>();
private
StringRedisTemplate
stringRedisTemplate
=
new
StringRedisTemplate
();
...
...
@@ -59,7 +61,7 @@ public abstract class AbstractRedisConfig {
return
;
}
defaultDb
=
this
.
getDbs
().
get
(
0
);
if
(
this
.
getDbs
().
size
()
=
=
2
&&
this
.
getDbs
().
get
(
1
)!=
null
){
if
(
this
.
getDbs
().
size
()
>
=
2
&&
this
.
getDbs
().
get
(
1
)!=
null
){
totalDbs
=
this
.
getDbs
().
get
(
1
);
log
.
info
(
"init totalDbs : {}"
,
totalDbs
);
for
(
int
i
=
0
;
i
<
totalDbs
;
i
++)
{
...
...
@@ -75,6 +77,11 @@ public abstract class AbstractRedisConfig {
log
.
info
(
"###### START 初始化 Redis-queue{} "
+
this
.
getClass
().
getSimpleName
()+
"连接池 START ######"
,
this
.
getHost
());
//初始化队列
LettuceConnectionFactory
factory
=
null
;
if
(
this
.
getDbs
().
size
()==
3
){
stringTemplateDb
=
this
.
getDbs
().
get
(
2
);
}
else
{
stringTemplateDb
=
totalDbs
-
1
;
}
if
(
totalDbs
==
1
){
log
.
info
(
"###### 正在加载Redis-queue-db-"
+
defaultDb
+
" ######"
);
factory
=
getDbFactory
(
defaultDb
);
...
...
@@ -156,7 +163,7 @@ public abstract class AbstractRedisConfig {
if
(
totalDbs
==
1
){
factory
=
getDbFactory
(
defaultDb
);
}
else
{
factory
=
getDbFactory
(
totalDbs
-
1
);
factory
=
getDbFactory
(
stringTemplateDb
);
}
StringRedisTemplate
stringRedisTemplate
=
new
StringRedisTemplate
();
stringRedisTemplate
.
setConnectionFactory
(
factory
);
...
...
liquidnet-bus-common/liquidnet-common-service-base/src/main/java/com/liquidnet/service/base/constant/MQConst.java
View file @
b9aa793d
...
...
@@ -21,7 +21,7 @@ public class MQConst {
private
final
String
desc
;
AdamQueue
(
String
key
,
String
group
,
String
desc
)
{
this
.
key
=
"test:"
.
concat
(
key
)
;
this
.
key
=
key
;
this
.
group
=
group
;
this
.
desc
=
desc
;
}
...
...
@@ -62,7 +62,7 @@ public class MQConst {
private
final
String
desc
;
KylinQueue
(
String
key
,
String
group
,
String
desc
)
{
this
.
key
=
"test:"
.
concat
(
key
)
;
this
.
key
=
key
;
this
.
group
=
group
;
this
.
desc
=
desc
;
}
...
...
@@ -103,7 +103,7 @@ public class MQConst {
private
final
String
desc
;
SweetQueue
(
String
key
,
String
group
,
String
desc
)
{
this
.
key
=
"test:"
.
concat
(
key
)
;
this
.
key
=
key
;
this
.
group
=
group
;
this
.
desc
=
desc
;
}
...
...
@@ -133,7 +133,7 @@ public class MQConst {
private
final
String
desc
;
CandyQueue
(
String
key
,
String
group
,
String
desc
)
{
this
.
key
=
"test:"
.
concat
(
key
)
;
this
.
key
=
key
;
this
.
group
=
group
;
this
.
desc
=
desc
;
}
...
...
@@ -168,7 +168,7 @@ public class MQConst {
private
final
String
desc
;
SlimeQueue
(
String
key
,
String
group
,
String
desc
)
{
this
.
key
=
"test:"
.
concat
(
key
)
;
this
.
key
=
key
;
this
.
group
=
group
;
this
.
desc
=
desc
;
}
...
...
@@ -198,7 +198,7 @@ public class MQConst {
private
final
String
desc
;
StoneQueue
(
String
key
,
String
group
,
String
desc
)
{
this
.
key
=
"test:"
.
concat
(
key
)
;
this
.
key
=
key
;
this
.
group
=
group
;
this
.
desc
=
desc
;
}
...
...
@@ -222,7 +222,7 @@ public class MQConst {
private
final
String
desc
;
SmileQueue
(
String
key
,
String
group
,
String
desc
)
{
this
.
key
=
"test:"
.
concat
(
key
)
;
this
.
key
=
key
;
this
.
group
=
group
;
this
.
desc
=
desc
;
}
...
...
@@ -247,7 +247,7 @@ public class MQConst {
private
final
String
desc
;
ChimeQueue
(
String
key
,
String
group
,
String
desc
)
{
this
.
key
=
"test:"
.
concat
(
key
)
;
this
.
key
=
key
;
this
.
group
=
group
;
this
.
desc
=
desc
;
}
...
...
@@ -309,7 +309,7 @@ public class MQConst {
private
final
String
desc
;
GoblinQueue
(
String
key
,
String
group
,
String
desc
)
{
this
.
key
=
"test:"
.
concat
(
key
)
;
this
.
key
=
key
;
this
.
group
=
group
;
this
.
desc
=
desc
;
}
...
...
@@ -340,7 +340,7 @@ public class MQConst {
private
final
String
desc
;
GalaxyQueue
(
String
key
,
String
group
,
String
desc
)
{
this
.
key
=
"test:"
.
concat
(
key
)
;
this
.
key
=
key
;
this
.
group
=
group
;
this
.
desc
=
desc
;
}
...
...
liquidnet-bus-config/liquidnet-config/application-test.yml
View file @
b9aa793d
...
...
@@ -33,43 +33,43 @@ liquidnet:
redis
:
kylin
:
database
:
255
dbs
:
0,256
dbs
:
0,256
,251
host
:
r-2zeucai3yj2t0f4nmzpd.redis.rds.aliyuncs.com
port
:
6380
password
:
7eoK2XehKqF1
goblin
:
database
:
255
dbs
:
0,256
dbs
:
0,256
,251
host
:
r-2zeucai3yj2t0f4nmzpd.redis.rds.aliyuncs.com
port
:
6380
password
:
7eoK2XehKqF1
slime
:
database
:
255
dbs
:
0,256
dbs
:
0,256
,251
host
:
r-2zeucai3yj2t0f4nmzpd.redis.rds.aliyuncs.com
port
:
6380
password
:
7eoK2XehKqF1
dragon
:
database
:
255
dbs
:
0,256
dbs
:
0,256
,251
host
:
r-2zeucai3yj2t0f4nmzpd.redis.rds.aliyuncs.com
port
:
6380
password
:
7eoK2XehKqF1
sweet
:
database
:
255
dbs
:
0,256
dbs
:
0,256
,251
host
:
r-2zeucai3yj2t0f4nmzpd.redis.rds.aliyuncs.com
port
:
6380
password
:
7eoK2XehKqF1
adam
:
database
:
255
dbs
:
0,256
dbs
:
0,256
,251
host
:
r-2zeucai3yj2t0f4nmzpd.redis.rds.aliyuncs.com
port
:
6380
password
:
7eoK2XehKqF1
candy
:
database
:
255
dbs
:
0,256
dbs
:
0,256
,251
host
:
r-2zeucai3yj2t0f4nmzpd.redis.rds.aliyuncs.com
port
:
6380
password
:
7eoK2XehKqF1
...
...
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