Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
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
YZG
yzg-util
Commits
a12d4b9e
Commit
a12d4b9e
authored
May 14, 2022
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复等待时间
parent
774463e3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
13 deletions
+10
-13
MessageSendServiceImpl.java
...m/yanzuoguang/mq/service/impl/MessageSendServiceImpl.java
+10
-13
No files found.
yzg-util-mq/src/main/java/com/yanzuoguang/mq/service/impl/MessageSendServiceImpl.java
View file @
a12d4b9e
...
@@ -84,20 +84,17 @@ public class MessageSendServiceImpl implements MessageSendService {
...
@@ -84,20 +84,17 @@ public class MessageSendServiceImpl implements MessageSendService {
// 设置编号
// 设置编号
CorrelationData
correlationData
=
new
CorrelationData
();
CorrelationData
correlationData
=
new
CorrelationData
();
correlationData
.
setId
(
finalMessageId
);
correlationData
.
setId
(
finalMessageId
);
rabbitTemplate
.
getRabbitTemplate
().
convertAndSend
(
req
.
getExchangeName
(),
req
.
getRouteKey
(),
req
.
getMessage
(),
new
MessagePostProcessor
()
{
rabbitTemplate
.
getRabbitTemplate
().
convertAndSend
(
req
.
getExchangeName
(),
req
.
getRouteKey
(),
req
.
getMessage
(),
message
->
{
@Override
// 设置队列消息持久化
public
Message
postProcessMessage
(
Message
message
)
throws
AmqpException
{
MessageProperties
properties
=
message
.
getMessageProperties
();
// 设置队列消息持久化
// 设置持久化
MessageProperties
properties
=
message
.
getMessageProperties
();
properties
.
setDeliveryMode
(
MessageDeliveryMode
.
PERSISTENT
);
// 设置持久化
// 设置消息编号
properties
.
setDeliveryMode
(
MessageDeliveryMode
.
PERSISTENT
);
properties
.
setMessageId
(
StringHelper
.
getIdShort
(
finalMessageId
,
TEMP_ID
));
// 设置消息编号
if
(
req
.
getDedTime
()
>
0
)
{
properties
.
setMessageId
(
StringHelper
.
getIdShort
(
finalMessageId
,
TEMP_ID
));
properties
.
setExpiration
(
req
.
getDedTime
()
+
""
);
if
(
req
.
getDedTime
()
>
0
)
{
properties
.
setExpiration
(
req
.
getDedTime
()
+
""
);
}
return
message
;
}
}
return
message
;
},
correlationData
);
},
correlationData
);
return
req
.
getMessageId
();
return
req
.
getMessageId
();
}
}
...
...
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