Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
property-management
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenjunxiong
property-management
Commits
1304f8e0
Commit
1304f8e0
authored
Apr 08, 2022
by
zhangjw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增redis锁解决多消费者消费事件数据重新问题
parent
382aa512
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
jeecg-boot-parent/jeecg-boot-module-property/src/main/java/org/jeecg/pm/mq/EventMessageListener.java
+9
-0
No files found.
jeecg-boot-parent/jeecg-boot-module-property/src/main/java/org/jeecg/pm/mq/EventMessageListener.java
View file @
1304f8e0
...
@@ -67,14 +67,23 @@ public class EventMessageListener {
...
@@ -67,14 +67,23 @@ public class EventMessageListener {
@JmsListener
(
destination
=
EPS_TOPIC
)
@JmsListener
(
destination
=
EPS_TOPIC
)
public
void
epsProcessMessage
(
BytesMessage
bytesMessage
)
throws
Exception
{
public
void
epsProcessMessage
(
BytesMessage
bytesMessage
)
throws
Exception
{
String
lock
=
EPS_TOPIC
;
try
{
final
byte
[]
bytes
=
new
byte
[(
int
)
bytesMessage
.
getBodyLength
()];
final
byte
[]
bytes
=
new
byte
[(
int
)
bytesMessage
.
getBodyLength
()];
bytesMessage
.
readBytes
(
bytes
);
bytesMessage
.
readBytes
(
bytes
);
// 壳文件字段,EventDis类为event_dis.proto文件解析而来,CommEventLog类为事件壳文件类
final
EventDis
.
CommEventLog
commEventLog
=
EventDis
.
CommEventLog
.
parseFrom
(
bytes
);
final
EventDis
.
CommEventLog
commEventLog
=
EventDis
.
CommEventLog
.
parseFrom
(
bytes
);
lock
=
lock
+
commEventLog
.
getLogId
();
if
(
redisTemplate
.
opsForValue
().
setIfAbsent
(
lock
,
lock
))
{
final
PmEventInfo
pmEventInfo
=
this
.
recode
(
commEventLog
);
final
PmEventInfo
pmEventInfo
=
this
.
recode
(
commEventLog
);
pmEventInfo
.
setSubsystem
(
PmEventInfo
.
EPS
);
pmEventInfo
.
setSubsystem
(
PmEventInfo
.
EPS
);
pmEventInfoService
.
saveEvent
(
pmEventInfo
);
pmEventInfoService
.
saveEvent
(
pmEventInfo
);
log
.
info
(
"EPS_TOPIC:{}"
,
pmEventInfo
);
log
.
info
(
"EPS_TOPIC:{}"
,
pmEventInfo
);
}
}
}
finally
{
redisTemplate
.
delete
(
lock
);
}
}
@SneakyThrows
@SneakyThrows
...
...
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