记得上下班打卡 | 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
fefc378f
Commit
fefc378f
authored
Apr 25, 2022
by
jiangxiulong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
炳 mongo消费
parent
fed72ff5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
13 deletions
+21
-13
AbstractMdbRedisReceiver.java
...ice/consumer/kylin/receiver/AbstractMdbRedisReceiver.java
+21
-13
No files found.
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-kylin/src/main/java/com/liquidnet/service/consumer/kylin/receiver/AbstractMdbRedisReceiver.java
View file @
fefc378f
...
@@ -56,31 +56,39 @@ public abstract class AbstractMdbRedisReceiver implements StreamListener<String,
...
@@ -56,31 +56,39 @@ public abstract class AbstractMdbRedisReceiver implements StreamListener<String,
}
}
private
boolean
consumerMessageHandler
(
String
msg
)
{
private
boolean
consumerMessageHandler
(
String
msg
)
{
boolean
aBoolean
=
fals
e
;
boolean
aBoolean
=
tru
e
;
try
{
try
{
GoblinQueueBizMongoDto
queueBizMongoDto
=
JsonUtils
.
fromJson
(
msg
,
GoblinQueueBizMongoDto
.
class
);
GoblinQueueBizMongoDto
queueBizMongoDto
=
JsonUtils
.
fromJson
(
msg
,
GoblinQueueBizMongoDto
.
class
);
if
(
null
==
queueBizMongoDto
)
{
if
(
null
!=
queueBizMongoDto
)
{
aBoolean
=
true
;
}
else
{
String
collectName
=
queueBizMongoDto
.
getCollect
(),
columnName
=
queueBizMongoDto
.
getColumn
();
String
collectName
=
queueBizMongoDto
.
getCollect
(),
columnName
=
queueBizMongoDto
.
getColumn
();
String
prefix
=
queueBizMongoDto
.
get
BizId
(),
bizId
=
queueBizMongoDto
.
getBizId
();
String
prefix
=
queueBizMongoDto
.
get
Prefix
(),
bizId
=
queueBizMongoDto
.
getBizId
();
Object
o
;
switch
(
queueBizMongoDto
.
getOpType
())
{
switch
(
queueBizMongoDto
.
getOpType
())
{
case
1
:
// insert
case
1
:
// insert
mongoTemplate
.
insert
(
redisUtil
.
get
(
prefix
.
concat
(
bizId
)),
collectName
);
o
=
redisUtil
.
get
(
prefix
.
concat
(
bizId
));
aBoolean
=
true
;
if
(
null
!=
o
)
{
mongoTemplate
.
insert
(
o
,
collectName
);
}
break
;
break
;
case
2
:
// update
case
2
:
// update
BasicDBObject
basicDBObject
=
(
BasicDBObject
)
AbstractMdbRedisReceiver
.
BASIC_DB_OBJECT
.
clone
();
o
=
redisUtil
.
get
(
prefix
.
concat
(
bizId
));
UpdateResult
updateResult
=
mongoTemplate
.
getCollection
(
collectName
).
updateOne
(
if
(
null
!=
o
)
{
Query
.
query
(
Criteria
.
where
(
columnName
).
is
(
bizId
)).
getQueryObject
(),
BasicDBObject
basicDBObject
=
(
BasicDBObject
)
AbstractMdbRedisReceiver
.
BASIC_DB_OBJECT
.
clone
();
basicDBObject
.
append
(
"$set"
,
mongoTemplate
.
getConverter
().
convertToMongoType
(
redisUtil
.
get
(
prefix
.
concat
(
bizId
))))
UpdateResult
updateResult
=
mongoTemplate
.
getCollection
(
collectName
).
updateOne
(
);
Query
.
query
(
Criteria
.
where
(
columnName
).
is
(
bizId
)).
getQueryObject
(),
aBoolean
=
updateResult
.
getModifiedCount
()
>
0
;
basicDBObject
.
append
(
"$set"
,
mongoTemplate
.
getConverter
().
convertToMongoType
(
o
))
);
}
break
;
default
:
log
.
error
(
"CONSUMER MSG ERR_HANDLE[未知的操作类型,{}]"
,
msg
);
break
;
}
}
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"CONSUMER MSG EX_HANDLE ==> [{}]:{}"
,
this
.
getRedisStreamKey
(),
msg
,
e
);
log
.
error
(
"CONSUMER MSG EX_HANDLE ==> [{}]:{}"
,
this
.
getRedisStreamKey
(),
msg
,
e
);
aBoolean
=
false
;
}
finally
{
}
finally
{
if
(!
aBoolean
)
{
if
(!
aBoolean
)
{
HashMap
<
String
,
String
>
map
=
CollectionUtil
.
mapStringString
();
HashMap
<
String
,
String
>
map
=
CollectionUtil
.
mapStringString
();
...
...
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