Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
毛树良
/
VVAS-DataCenter-DBWriter
Go to a project
Project
Repository
Merge Requests
0
Pipelines
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 00bded54
authored
May 07, 2025
by
姚冰
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[chg] reid统计添加单线程异步顺序处理,防止处理时间过长重复消费
1 parent
f23c0832
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
src/main/java/com/viontech/keliu/consumer/MallDataStatisticsConsumer.java
src/main/java/com/viontech/keliu/consumer/MallDataStatisticsConsumer.java
View file @
00bded5
package
com
.
viontech
.
keliu
.
consumer
;
import
cn.hutool.core.thread.ThreadUtil
;
import
cn.hutool.http.HttpUtil
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.viontech.keliu.constants.KafkaConstants
;
...
...
@@ -18,6 +19,7 @@ import org.springframework.util.CollectionUtils;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.ExecutorService
;
import
java.util.stream.Collectors
;
@Service
...
...
@@ -33,6 +35,8 @@ public class MallDataStatisticsConsumer {
@Value
(
"${vion.consumer.mallDataStatistics.zoneNum:true}"
)
private
boolean
zoneNumEnable
;
private
ExecutorService
executorService
=
ThreadUtil
.
newFixedExecutor
(
1
,
1024
,
"dataStatistics-"
,
true
);
@KafkaListener
(
topics
=
KafkaConstants
.
MALL_DATA_STATISTICS_TOPIC
,
autoStartup
=
"${vion.consumer.mallDataStatistics.autoStartup:false}"
,
groupId
=
"MallDataStiatistics"
...
...
@@ -53,7 +57,11 @@ public class MallDataStatisticsConsumer {
for
(
ConsumerRecord
<
String
,
String
>
consumerRecord
:
recordValues
)
{
try
{
MallDataStatisticsInfo
mallDataStatisticsInfo
=
objectMapper
.
readValue
(
consumerRecord
.
value
(),
MallDataStatisticsInfo
.
class
);
executorService
.
execute
(()
->
{
log
.
info
(
"处理mallDataStatisticsInfo,mallId:{},countDate:{}, 开始"
,
mallDataStatisticsInfo
.
getMallId
(),
mallDataStatisticsInfo
.
getCountDate
());
execDataStatistics
(
mallDataStatisticsInfo
);
});
// execDataStatistics(mallDataStatisticsInfo);
}
catch
(
Exception
ee
)
{
log
.
error
(
"处理mallDataStatisticsInfo[{}], JsonDeserializerThrowable={}"
,
entry
.
getKey
(),
ee
.
getMessage
(),
ee
);
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment